A critical error on a WordPress website can be caused by various issues such as plugin or theme conflicts, corrupted files, or server configuration problems. Here are the steps to diagnose and resolve a critical error:
WordPress has a built-in feature to detect fatal PHP errors and notify the site admin via email. This notification typically includes details about the error and can help in diagnosing the issue. Here’s a detailed approach to resolving a fatal PHP error based on this information:
Step 1
1. Check Admin Email Notification
- Locate the email sent by WordPress to the admin address. This email often contains specifics about which plugin or theme is causing the issue.
- The email subject usually looks like: “Your Site is Experiencing a Technical Issue”.
2. Review the Error Details
- The email will provide details such as the file and line number where the error occurred, as well as a stack trace.
- Use this information to identify the problematic plugin or theme.
3. Access Your Site in Recovery Mode
- The email should contain a special link to access your WordPress site in recovery mode. This mode allows you to log in to the admin dashboard even if the site is experiencing a critical error.
- Click on the link provided in the email to enter recovery mode.
4. Deactivate the Problematic Plugin or Theme
You need to manually disable each plugin or Theme first by changing its name. You can put “-disabled” after the Plugin’s current name to disable them. You can do this in your File menu of cPanel. Then refresh your website with ctrl + F5. Your site is visible again but not yet as you would like it to be.
That’s because the required plugins are disabled.
Then enable each Plugin one by one and refresh your website each time you have enabled a Plugin. You do this by removing “-disabled.”
This way you can detect which plugin is causing the problem. Once you have found the Plugin or Theme causing the problem, uninstall it and then reinstall it from a backup.
Here’s where making regular backups comes in handy.
You can also switch the Plugins or theme of when you have access to your Admin controle of WordPress.
- Once logged in via recovery mode, navigate to the Plugins or Themes section of the WordPress dashboard.
- Deactivate the plugin or switch the theme mentioned in the email.
- Then, folow the steps above.
5. Further Troubleshooting
After deactivating the problematic component, you can perform additional steps to resolve the issue:
A. Debugging
- Follow the earlier step to enable debugging in
wp-config.php
to gather more details if needed.
B. Update the Plugin or Theme
- If the problematic plugin or theme has an update available, update it to the latest version. This might fix compatibility issues.
C. Check for Compatibility
- Ensure that the plugin or theme is compatible with your current version of WordPress and PHP.
D. Reinstall the Plugin or Theme
- Sometimes, reinstalling the plugin or theme can resolve corrupted files issues.
6. Contact Developer Support
- If deactivating the plugin or theme resolves the issue but you still need it active, consider reaching out to the plugin or theme developer for support.
- Provide them with the error details from the email for faster assistance.
7. Restore from Backup
- If you have recent backups of your site, you may consider restoring from a backup before the error occurred.
Summary Steps:
- Check the admin email for error details and recovery mode link.
- Access recovery mode using the link provided.
- Deactivate the problematic plugin or theme via the WordPress dashboard.
- Enable debugging if more information is needed.
- Update or reinstall the plugin or theme.
- Check compatibility with your WordPress and PHP versions.
- Contact developer support if necessary.
- Consider restoring from a backup if the issue persists.
Or you can also try Step 2
1. Enable Debugging Mode
Enable WordPress debugging to get more information about the error.
- Add the following lines to your
wp-config.php
file, just before the line that says/* That's all, stop editing! Happy publishing.*/
:
- This will create a debug log file (
debug.log
) in thewp-content
directory.
2. Check the Debug Log
- Access the
wp-content/debug.log
file via FTP or your hosting file manager to view the error messages and stack traces.
3. Disable All Plugins
- Access your site via FTP or your hosting file manager.
- Navigate to the
wp-content
directory and rename theplugins
folder to something likeplugins_old
. This will deactivate all plugins.
4. Switch to a Default Theme
- Similarly, navigate to the
wp-content/themes
directory. - Rename your active theme folder to something else. WordPress will automatically revert to a default theme like
twentytwentyone
if it is installed.
5. Check File Permissions
Ensure that WordPress has the correct permissions to read and write files. The typical recommended permissions are:
- Files:
644
- Directories:
755
6. Increase PHP Memory Limit
- Edit your
wp-config.php
file and add or modify the following line to increase the PHP memory limit:
7. Re-upload Core Files
- Download a fresh copy of WordPress from wordpress.org.
- Extract the files and upload the
wp-admin
andwp-includes
directories to your server, overwriting the existing files. Be careful not to overwrite thewp-content
directory or thewp-config.php
file.
8. Update PHP Version
Ensure that your hosting server is running a compatible version of PHP. WordPress recommends using PHP 7.4 or higher.
9. Check .htaccess File
- If you have access to the
.htaccess
file, try renaming it to.htaccess_old
to see if the issue is related to configuration rules. WordPress will generate a new.htaccess
file if necessary.
10. Contact Hosting Support
If none of the above steps resolve the issue, contact your hosting provider’s support team. They can help diagnose server-level issues or review server logs for more clues.
Summary of Actions
- Enable debugging in
wp-config.php
. - Check the debug log for errors.
- Disable all plugins by renaming the
plugins
folder. - Switch to a default theme by renaming your current theme folder.
- Verify file permissions (644 for files, 755 for directories).
- Increase the PHP memory limit in
wp-config.php
. - Re-upload WordPress core files (
wp-admin
andwp-includes
). - Ensure PHP version compatibility.
- Check the
.htaccess
file for issues. - Contact hosting support if the problem persists.
These steps should help you identify and resolve the critical error on your WordPress site.