Search code examples
wordpressposix

File Permissions Reverting to write-only for Wordpress site


I've got a Wordpress site that's won't allow users to edit any Pages. Editing Settings works fine but whenever I attempt to edit any of the user-created pages, it shows the following warnings and I am unable to save any changes.

Warning: file_get_contents(/<base filepath>/wp-content/themes/Avada/404.php): failed to open stream: Permission denied in <base filepath>/wp-includes/class-wp-theme.php on line 1147

Warning: file_get_contents(/<base filepath>/wp-content/themes/Avada/archive.php): failed to open stream: Permission denied in <base filepath>wp-includes/class-wp-theme.php on line 1147

For some reason, the theme's 404.php and archive.php only have write access for the owner: --w-------. The other files in that directory have have less restricted permissions: -rw----r--.

My first stab at fixing this was to run chmod 604 on the files.

After I did that, I attempted to edit the pages. The errors weren't rendering but when I attempted to preview or save changes, it failed. When I re-inspect the files, they've reverted to being write only for the owner.

Can anyone tell me how to fix this permissions issue permanently? I'm curious what else might be responsible for reverting the permissions I set.


Solution

  • To rule out ant theme/plugin conflict, try:

    • Deactivating ALL (yes all) plugins temporarily to see if this resolves the problem (plugin functions can interfere). If this works, re-activate them individually (one-by-one) to find the problematic plugin(s).
    • Switching to the unedited default Theme for a moment using the WP dashboard to rule out any theme-specific issue (theme functions can interfere like plugins).
    • If you can install plugins, try Health Check. On the troubleshooting tab, you can click the button to disable all plugins and change the theme for you, while you’re still logged in, without affecting normal visitors to your site.

    Also try to check your user permissions with Capability Manager Enhanced. Then write the results.