How to manually repair WordPress files in core, themes, or plugins Print

  • 0

Problem Description

  • You're experiencing an error with a WordPress plugin or you're experiencing an error with a WordPress theme
  • You might be receiving a White Screen of Death and/or Parse Error in WordPress.
  • The error is serious enough to be logged to the web server error log

Problem Resolution

If you don't already have the specific error that was triggered, click here to learn how to determine the error, then come on back here to learn how to fix it.

The error from the logs will show a full path to a plugin file like this (in this example it's a plugin called WP SEO that had not been updated): /var/www/vhosts/<your_domain>/httpdocs/wp-content/plugins/wpseo/<one_of_the_plugin_files.php>

If the error log entry shows a path to a file within your theme, it'll looks like this instead (in this example it's the theme Twenty Twenty): /var/www/vhosts/<your_domain>/httpdocs/wp-content/themes/twentytwenty/<one_of_the_theme_files.php>

Tip: When using the Plesk File Manager, the first 4 parts of any path provided in the logs can be ignored. In the examples above that means you can ignore /var/www/vhosts/<your_domain>/ and focus entirely on just this part: httpdocs/wp-content/plugins/wpseo/<one_of_the_plugin_files.php>

The following steps will show you how to reinstall the plugin or theme causing the issue. This can resolve the problem when the developer of the software has released a quick update to fix the issue, or if the reason for the issue was a failed automatic update that caused corruption with the theme or plugin file(s).

How to re-install a plugin or theme manually

  1. Log in to Plesk and choose Files to access the Plesk File Manager
  2. Navigate to the directory provided in the error
  3. If you wish to make a backup first (never a bad plan), check the box beside the plugin or theme folder that was causing problems (wpseo in the example above or twentytwenty in the theme example), then press the "Add to Archive" button and Plesk will create a zip file containing the folder and its contents.
  4. Download a fresh copy of the latest version of the theme or plugin from wherever you obtained it initially. For example, if you purchased the theme, go to the store you purchased it from, login and download the latest version. If it was a free theme on the WordPress Theme Directory, or a free plugin on the WordPress Plugins Directory you can search for it and download it there.
  5. Check the box beside the plugin or theme directory that was causing problems (wpseo in the example above), then press the "Remove" button.
  6. Upload your freshly downloaded copy of the theme or plugin from your computer to the themes or plugins directory, then check the box to the left of your freshly uploaded zip file and press the Extract Files button.

Now try to load the page for which you were getting a white screen again. Either the site will load as expected, or you will get a different error (although it may look similar, look closely!). If you do receive a different error, repeat the steps above until you no longer receive any errors.

If you still receive the exact same error (it must be identical) after the re-install, here's some tips:

  • The issue may be a bug in the latest version of the software. Your next best step is to download the previous version and use steps 5 and 6 above to install that slightly older version of the plugin. You should then report the bug to the developer by providing the precise error from the server error logs. This is needed for two reasons: 1) so that they can be sure to fix it for everyone using their software, and 2) because your own software will automatically update again in the near future and break the site again if this bug is still present. The faster the developer fixes the bug, the less likely this issue will occur again.
  • The issue may be a conflict with another plugin. If the error is shown to be in a plugin that has its own extensions that hook into it (such as a WooCommerce error and you have WooCommerce Extensions installed, or an Elementor error and you have Elementor addons installed), you should also ensure that all extensions or addons for the plugin are fully updated or reinstalled.

How to repair or reinstall WordPress Core Files

If the error indicates that the file with a problem is in the wp-admin or wp-includes directory, then you may have ended up with corrupt core WordPress files. This most often occurs when there's a failed update.

To resolve this, download a fresh copy of the WordPress files and decompress/extract it. In the decompressed folders and files, find the core WordPress folder or file you wish to replace on your site (such as wp-admin). If it's just a single file, proceed with the steps below now. If it's an entire directory, compress/archive it into its own zip file (on both Windows and Mac there is typically the option to do this when you right/two-finger click on the folder), then proceed with the steps below.

  1. Log in to Plesk and choose Files to access the Plesk File Manager
  2. Navigate to the path provided in the error
  3. Check the box beside the core WordPress directory or file that is causing problems (example: wp-admin), then press the "Remove" button.
  4. If you're replacing an entire directory, upload the zip file you created, then check the box to the left of your freshly uploaded zip file and press the Extract Files button. If it's just a single file you're replacing, you can simply upload it - no need to extract anything.

Now try to load the page for which you were getting a white screen again. Either the site will load as expected, or you will get a different error (although it may look similar, look closely!). If you do receive a different error, repeat the steps above until you no longer receive any errors.

Fixing wp-config.php access (this is not common)

If you get an error like: PHP Fatal error: require_once(): Failed opening required '/var/www/vhosts/[domain]/httpdocs/wp-config.php' This occurs because of security hardening that we've completed on your server. To fix it:

  1. Log in to Plesk
  2. Choose "PHP Settings" for the domain having problems
  3. Change the option at the top of the page that says "run PHP as" from Apache Module to FastCGI Application Served by Apache.
  4. Click OK at the bottom of the page

That should bring the site back online or at least give you a different error in the logs to work with.


Was this answer helpful?

← Back