Skip to content

How to fix file and folder permissions error in WordPress?

Sometimes when working with WordPress, you may encounter a file and folder permissions error. This issue can cause a number of problems, such as the inability to install plugins, update the site, or change settings. Fortunately, there are various methods to fix these errors. Let's take a closer look at them.

Manually change file and folder permissions

The simplest solution may be to manually change file and folder permissions using FTP. WordPress files should have permissions of 644 or 640 and folders should have permissions of 755 or 750. We can use an FTP program like FileZilla to do this:

  1. Connect to your server using an FTP client.
  2. Go to your WordPress root folder.
  3. Select all files and folders, then right-click and select “File permissions”.
  4. In the new window, enter the appropriate permissions (644 for files, 755 for folders), check "Recurse into subdirectories" and select "Apply to files only" or "Apply to directories only". Click OK.

Please note that some files and folders may require different permissions. For example, file .htaccess should have permissions 644, and the folder wp-content 775.

File Manager plugin for WordPress

Another approach to fixing file and folder permission errors is to use a plugin FileManager for WordPress. This plugin allows you to manage files and folders directly from the WordPress admin panel.

  1. Install and activate the File Manager plug-in.
  2. Go to File Manager in the administration panel.
  3. Select the files or folders you want to change permissions for, right-click and select “Change Permissions”.
  4. Enter the appropriate permissions (644 for files, 755 for folders) and click “Change”.

3. PHP Snippet to change permissions

In some cases, changing file and folder permissions via FTP or a plugin may not be enough. In this case, you can use a PHP snippet to change permissions:

isDir() && !$fileinfo->isDot()) { chmod($fileinfo->getPathname(), 0755); } else { chmod($fileinfo->getPathname(), 0644); } } ?>

This snippet will change the permissions of all files and folders in your WordPress directory. Remember that you need to change “/path/to/wordpress” to the actual path to your WordPress directory.

Ultimately, it's always a good idea to contact your hosting service if none of the above methods help. This may be the result of a server configuration that you cannot change yourself. With experience and resources, your hosting provider should be able to quickly identify and resolve the problem.

Check out the offer of 1500+ Premium WordPress plugins and themes!