Suggestions on how to fix plugin, themes and fatal errors in WordPress.

Sometimes plugins or themes updates fail and one is left with a non working web site. What is also called a fatal error.

There are multiple approaches to try out to figure out where the problem is located.

1- Is there an error message? If so copy the message and make a search and see if a solution shows up.
2- If the error message involves a plugin then deactivate it by renaming the specific plugin folder through FTP or the File Manager. Update the plugin if possible. As the developer might already have a fix ready.

Finding the non functioning plugin update.

Copy the error message and make a search and notice what kinds of information shows up. Perhaps a solution is also found.

If the web site is down with a fatal error and you are not able to see the web site. Then login to your web hosts File manager or use FTP and login so that you have access to the WordPress folders and files.

In the File Manager:
Go into the public_html (where the web site files usually are) and open the wp-content folder. It contains multiple folders among these plugins and themes.

A specific plugin is causing an error.

If you have found hints that a specific plugin might be causing the error then find the specific plugin folder and rename it. Renaming the plugin folder will deactivate the plugin. Check and see if the web site is up and login. See if you can update the plugin as the developer might already have fixed the problem.

A specific page contains an error.

Install “Freesoul Deactivate Plugins: deactivate plugins on specific pages” and select a plugin and the page the plugin is not to be active on. See if it makes a difference.

If you do not know if it is a plugin error or something else.

Rename the parent plugins folder. I usually just rename it to plugins1. Renaming the plugin folder will automatically deactivate all the plugins located inside the parent plugins folder. Check and see if the web site is up and working.

cPanel-File-Manager-wp-content-renaming-plugin-folder-to-deactivate-all-active-plugins
cPanel: File Manager. wp-content folder. Renaming the plugin folder to deactivate all active plugins.

Login to the backend of your WordPress site and go to the Installed Plugins screens. The plugin screen will look similar to this.

Plugins have been deactivated outside the WordPress backend.
Plugins have been deactivated outside the WordPress backend.

If the site works then there seems to be a plugin causing the problem.

Cpanel: File manager/FTP -> rename the plugins parent folder back to it’s original name “plugins”.
WordPress backend: Installed plugins screen and activate one plugin at a time to check that everything is working alright. Sometimes just deactivating a plugin and activating it again the problem might go away. If the site goes down again, then go into the File Manager and into the plugins folder and find the plugin causing the error and forcefully deactivate the plugin (or rename multiple plugins if you are not sure which plugin caused the fatal error). Narrow in on which plugin is causing the error. By renaming to deactivate and then rename to give it back its original name. Be careful and notice which plugin you activate. When you find the plugin causing the error be sure to keep it deactivated and let plugin support know about the error, or make a search on the plugin site.

Finding the non functioning theme update error.

If updating a theme causes an error. Go to file manager/FTP -> wp-content -> themes and rename the active theme. A default theme will then take over. Check the WordPress site and see if it works. If it works then there might be a theme error.

Inspect and go to Console and see if there are any JavaScript errors.

Right click your web site and select Inspect and click the Console tab. Here is an example from a site:

Inspect-Console-errors-WordPress
Right click the browser and select Inspect. Click the Console tab to see the errors located there.

The above Console JavaScript errors is helpful to add to include when you contact theme or plugin support so the developers can see what has caused an error.

Fatal errors

Conclusion seen at the end. For these errors I had to replace the various WordPress files with a newer versions to get the site working again.

Here is a real life example of a Fatal error of a site that has not been updated in a while. I check the error_log text file which is located in root of the non functioning site. I went to File Manager / FTP to the root of the site and found the error_log file.
An example of a fatal error is:

PHP Fatal error: Array and string offset access syntax with curly braces is no longer supported in /home/cranitjg/herlighetenkursgard.no/wp-includes/script-loader.php on line 757 

I went to wordpress.org and downloaded the WordPress files. Inside the wp-includes downloaded folder I found the script-loader.php file and upload it to the wp-includes folder of the site which has the fatal error. Did a hard (browser) refresh of the site and rechecked the site. In this case it did not come back up again so I rechecked the error log to see what other errors showed up. The next error I noticed is:

PHP Fatal error: Unparenthesized a ? b : c ? d : e is not supported. Use either (a ? b : c) ? d : e or a ? b : (c ? d : e) in /home/cranitjg/herlighetenkursgard.no/wp-content/plugins/caldera-forms/classes/core.php on line 3723

I went to https://wordpress.org/plugins/caldera-forms/ and downloaded the plugin. Located the core.php file inside the classes folder and uploaded it to same location in the caldera forms plugin I am using on the site. Rechecked the site and noticed it was still down. Rechecked the error log and noticed a lot of errors. I looked for the next fatal error and found this line:

Uncaught Error: Call to undefined function get_magic_quotes_gpc() in /home/cranitjg/herlighetenkursgard.no/wp-includes/load.php:926

and

PHP Fatal error:  Uncaught Error: Call to undefined function wp_unregister_GLOBALS() in /home/cranitjg/herlighetenkursgard.no/wp-settings.php:65

There are now two files I had to upload. wp-includes/load.php and a wp-settings.php files. Load.php that goes into the wp-includes folder and wp-settings.php that goes into the root of the site. The site was still down, so I went to recheck the error log and noticed another plugin having an issue. I decided to this time to just delete the plugin instead of downloading and replacing the file that had the error. (I can always install the plugin again when the site is working.) Next step is opening the wp-config.php file and adjusting this line from false to true:
define( 'WP_DEBUG', true );

Again checking the error log to figure out which files I need to replace.

PHP Fatal error:  Uncaught Error: Failed opening required '/home/cranitjg/herlighetenkursgard.no/wp-includes/cache-compat.php' (include_path='.:/opt/alt/php80/usr/share/pear:/opt/alt/php80/usr/share/php:/usr/share/pear:/usr/share/php') in /home/cranitjg/herlighetenkursgard.no/wp-includes/load.php:716

I uploaded cache-compat.php into the wp-includes folder. Rechecked the site. As I have set the WP_DEBUG to true the errors are now seen on the frontend of the site.

WP_DEBUG set to true will show errors on the frontend of the site.

I keep replacing the files that are corrupted with original files from the WordPress files I downloaded from WordPress.org.

As too many files needed replacing I decided to zip the wp-includes folder and upload it to the non working site. I renamed the original wp-includes folder and unzipped the newer version of wp-includes. Then deleted the original wp-includes.

I also began searching for the errors online.

In the end I replaced all the default WordPress files located in the root (except wp-config.php which has the login and password information). I replaced wp-admin folder as well.

It now went to a white screen. I went to the homepagename.com/wp-admin and noticed the “Database Update Required” message. I clicked to update the database and the wp-login screen came up. I was finally able to login.

Conclusion was that I had to replace the various WordPress files: wp-includes folder, wp-admin folder and files located in the root of the site with newer versions.

Opening the WordPress configuration file to learn more about errors.

I have another tutorial which brings up how to turn on the debug commands in the wp-config file. As it is helpful to get additional information on where an error is located.
Editing the wp-config file and debugging in WordPress.

Restore the last backed up version of the site.

If you have not yet been able to fix the error then another option is to do a restore of the site. Your web host might be able to help you with fixing the errors, or you might have a restore software in the control panel to restore the site to the last backup. Here is an overview on using the cPanel backup and restore.

Or use a backup and restore plugin to get your web site up again.

Associated tutorial: Editing the wp-config file and debugging in WordPress.

Share the article:

Leave a Reply

Your email address will not be published.

ten + thirteen =