OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Wordpress theme-editor.php:Sorry, that file cannot be edited

  • Thread starter Thread starter user25780816
  • Start date Start date
U

user25780816

Guest
In worpdress I need to open Theme File editor and when I try to do that: Wordpress=>Appearance=>Theme File editor I receive an error message:Sorry, that file cannot be edited. /wordpress/wp-admin/theme-editor.php I don't know how can I fix it? I use xampp for localhost.

Reinstalled wordpress and db, still not working
<p>In worpdress I need to open Theme File editor and when I try to do that: Wordpress=>Appearance=>Theme File editor I receive an error message:Sorry, that file cannot be edited.
/wordpress/wp-admin/theme-editor.php
I don't know how can I fix it? I use xampp for localhost.</p>
<p>Reinstalled wordpress and db, still not working</p>
Continue reading...
 
In worpdress I need to open Theme File editor and when I try to do that: Wordpress=>Appearance=>Theme File editor I receive an error message:Sorry, that file cannot be edited. /wordpress/wp-admin/theme-editor.php I don't know how can I fix it? I use xampp for localhost.

Reinstalled wordpress and db, still not working
<p>In worpdress I need to open Theme File editor and when I try to do that: Wordpress=>Appearance=>Theme File editor I receive an error message:Sorry, that file cannot be edited.
/wordpress/wp-admin/theme-editor.php
I don't know how can I fix it? I use xampp for localhost.</p>
<p>Reinstalled wordpress and db, still not working</p>
Continue reading...
The error message "Sorry, that file cannot be edited" when trying to access the Theme File Editor in WordPress typically indicates permission or security restrictions. Here are several steps you can take to diagnose and resolve this issue:

### 1. **Check File Permissions**
Ensure that the files and folders in your WordPress installation have the correct permissions. For a local development environment like XAMPP, the recommended permissions are:

- Directories: 755
- Files: 644

You can set these permissions using a terminal or command prompt.

For Windows (using Command Prompt):
```sh
cd path\to\your\wordpress\installation
icacls * /T /C /grant "Users:F"
```

For Linux/Mac (using Terminal):
```sh
cd /path/to/your/wordpress/installation
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;
```

### 2. **Check File Ownership**
Make sure that the files and directories are owned by the correct user that the web server runs as. For local development, this is typically your user account.

For Linux/Mac (using Terminal):
```sh
cd /path/to/your/wordpress/installation
sudo chown -R yourusername:www-data .
```

### 3. **Disable Security Plugins**
If you have any security plugins installed (e.g., Wordfence, Sucuri), they might be restricting access to the Theme File Editor. Temporarily deactivate these plugins to see if the issue resolves.

### 4. **Update wp-config.php**
Ensure there are no configurations in `wp-config.php` that disable file editing. Specifically, look for the following lines and ensure they are commented out or set to `false`:

```php
define('DISALLOW_FILE_EDIT', false);
define('DISALLOW_FILE_MODS', false);
```

### 5. **Modify .htaccess**
Check if there are any rules in your `.htaccess` file that might be restricting access. Ensure the file has the default WordPress rules:

```htaccess
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
```

### 6. **Check PHP Configuration**
Ensure that your PHP configuration allows file operations. In your `php.ini` file, make sure the following settings are enabled:

```ini
file_uploads = On
allow_url_fopen = On
```

Restart your Apache server after making changes to `php.ini`.

### 7. **Ensure Sufficient PHP Memory Limit**
Sometimes low PHP memory limits can cause issues. Increase the PHP memory limit in `wp-config.php`:

```php
define('WP_MEMORY_LIMIT', '256M');
```

### 8. **Debug Mode**
Enable WordPress debug mode to see if there are any errors being logged:

```php
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);
```

Check the `wp-content/debug.log` file for any relevant error messages.

### 9. **Check Browser Console**
Open your browser's developer tools (usually F12 or right-click -> Inspect) and check the console for any JavaScript errors when trying to access the Theme File Editor.

### 10. **Check Server Logs**
Review your Apache error logs to see if there are any permission or access-related errors:

For XAMPP (typically found in `C:\xampp\apache\logs\`):
- `error.log`
- `access.log`

By following these steps, you should be able to diagnose and resolve the issue preventing you from accessing the Theme File Editor in WordPress on your local XAMPP setup.
 
Code:
How to Fix "Sorry, that file cannot be edited" Error in WordPress Theme File Editor on XAMPP
Introduction
When working with WordPress on a local server like XAMPP, you might encounter issues accessing the Theme File Editor. One common error is: "Sorry, that file cannot be edited" when navigating to WordPress => Appearance => Theme File Editor. This article will guide you through troubleshooting and resolving this error.

Understanding the Error
The error message indicates that WordPress is unable to edit the theme files, which can be due to various reasons, including incorrect file permissions, security settings, or configuration issues within your WordPress setup.

Step-by-Step Solutions
1. Check File Permissions
File permissions are crucial for WordPress to read and write files. Incorrect permissions can prevent you from editing theme files.

Navigate to Your Theme Folder:

Open the XAMPP control panel and start Apache and MySQL.
Go to your XAMPP installation directory (e.g., C:\xampp\htdocs\your-site\wp-content\themes).
Right-click on your theme folder and select "Properties."
Set Correct Permissions:

Ensure that the folder is not read-only.
Set the permissions to allow read, write, and execute for all users.
2. Disable WordPress File Edit Restrictions
WordPress may restrict file editing for security reasons. You can disable this restriction by modifying the wp-config.php file.

Open wp-config.php:

Locate the wp-config.php file in the root directory of your WordPress installation (C:\xampp\htdocs\your-site\wp-config.php).
Open the file with a text editor like Notepad or Visual Studio Code.
Modify the Configuration:

Add the following line of code before the /* That's all, stop editing! Happy publishing. */ line:
php
Copy code
define('DISALLOW_FILE_EDIT', false);
Save and close the file.
3. Verify Ownership and Group Settings
Ensure that the web server has the correct ownership and group settings for your WordPress files.

Check Ownership:

In the terminal, navigate to your WordPress directory:
bash
Copy code
cd /path/to/your/wordpress
Check the current ownership and group settings:
bash
Copy code
ls -l
Set Correct Ownership:

Change the ownership to the web server user (usually www-data for Linux):
bash
Copy code
sudo chown -R www-data:www-data /path/to/your/wordpress
4. Verify XAMPP Configuration
Sometimes, XAMPP settings can interfere with WordPress operations.

Check PHP Configuration:

Open the php.ini file located in C:\xampp\php\php.ini.
Ensure the following settings are enabled:
ini
Copy code
file_uploads = On
allow_url_fopen = On
Restart XAMPP:

After making changes to php.ini, restart Apache from the XAMPP control panel.
Conclusion
By following the steps outlined above, you should be able to resolve the "Sorry, that file cannot be edited" error in WordPress Theme File Editor on XAMPP. Ensure your file permissions, WordPress configurations, and XAMPP settings are correctly set up. If the issue persists, consider seeking help from the WordPress support forums or consulting with a WordPress developer.

Additional Resources
WordPress Codex: Changing File Permissions
XAMPP Documentation
By addressing these potential issues, you can ensure a smoother development experience with WordPress on your local XAMPP server.
 

Latest posts

M
Replies
0
Views
1
Marcos R. Guevara
M
Top