How to Fix WordPress Critical Error
A WordPress Critical Error occurs when a serious PHP problem prevents WordPress from loading normally. Depending on the cause, the error may affect the entire website, only the WordPress dashboard, or a specific page.
You may see a message such as:
“There has been a critical error on this website.”
This problem is often caused by a faulty plugin, incompatible theme, PHP version mismatch, exhausted memory, custom PHP code, or corrupted WordPress files.
Fortunately, most critical errors can be diagnosed without rebuilding the website. This guide explains the most effective ways to find and fix the problem.
What Causes a WordPress Critical Error?
The most common causes include:
- Plugin conflicts
- Theme compatibility problems
- PHP errors
- Outdated plugins or themes
- Incompatible PHP versions
- Insufficient PHP memory
- Incorrect custom PHP code
- Corrupted WordPress files
- Failed updates
- Server configuration problems
- Database-related issues
The fastest way to identify the cause is usually to check the WordPress error logs.
1. Check the WordPress Recovery Mode Email
When WordPress detects a fatal PHP error, it may send an email to the site’s administrator.
The email can contain:
- The affected plugin or theme
- The type of PHP error
- A recovery-mode link
- Instructions for accessing the dashboard
If you receive this email, use the recovery link and log in to WordPress.
Once inside, WordPress may identify the plugin or theme responsible for the failure. Disable the problematic component and then investigate whether an update or replacement is available.
If you do not receive the email, continue with the troubleshooting methods below.
2. Enable WordPress Debugging
WordPress has a built-in debugging system that can reveal the underlying PHP error.
Open:
wp-config.php
Find:
define( 'WP_DEBUG', false );
Change it to:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
This records errors without displaying technical information to visitors.
The log is usually located at:
/wp-content/debug.log
Look for entries created immediately before the critical error appeared.
For example, an error referencing:
/wp-content/plugins/example-plugin/
strongly suggests that plugin is involved.
After troubleshooting, disable debugging on a production website:
define( 'WP_DEBUG', false );
3. Disable All WordPress Plugins
A plugin conflict is one of the most common causes of a WordPress critical error.
If you can access the dashboard:
- Go to Plugins → Installed Plugins.
- Select all plugins.
- Choose Deactivate.
- Reload the website.
- If the error disappears, reactivate plugins one at a time.
- Test the website after each activation.
When the critical error returns, the last activated plugin is the likely cause.
If You Cannot Access wp-admin
Use your hosting File Manager or FTP.
Open:
/wp-content/
Rename:
plugins
to:
plugins-disabled
This prevents WordPress from loading the installed plugins.
If the website starts working, rename the directory back to:
plugins
Then troubleshoot the plugins individually.
4. Switch to a Default WordPress Theme
A theme can cause a critical error through incompatible PHP code, outdated functions, or incorrect customizations.
If the dashboard is accessible:
- Go to Appearance → Themes.
- Activate an available default WordPress theme.
- Reload the website.
If the error disappears, your previous theme is likely responsible.
If the Dashboard Is Inaccessible
Use File Manager or FTP and open:
/wp-content/themes/
Rename the directory of the active theme.
WordPress may then fall back to another available theme.
If this resolves the problem, inspect the original theme for:
- PHP compatibility issues
- Custom code
- Outdated functions
- Missing files
- Incorrect modifications
5. Check the PHP Version
A PHP version mismatch can cause fatal errors.
This commonly happens when:
- An old plugin is used with a newer PHP version
- An outdated theme is incompatible with the current PHP version
- The hosting provider changes the server’s PHP version
- Custom PHP code uses removed or deprecated functionality
Check the PHP version through your hosting control panel.
If the critical error appeared immediately after a PHP upgrade, temporarily test the previous compatible PHP version if your hosting environment allows it.
However, do not permanently downgrade to an unsupported PHP release. Instead, update or replace the software causing the compatibility problem.
6. Increase the WordPress Memory Limit
A PHP memory exhaustion error can produce a critical error.
Open:
wp-config.php
Add the following before the line containing That's all, stop editing!:
define( 'WP_MEMORY_LIMIT', '256M' );
define( 'WP_MAX_MEMORY_LIMIT', '512M' );
The actual amount of memory available also depends on the server’s PHP configuration.
If the error continues, check your hosting account’s memory limits and resource usage.
7. Check the PHP Error Log
Your hosting control panel may provide PHP error logs.
Look for messages such as:
Fatal error
Uncaught Error
Allowed memory size exhausted
Call to undefined function
Call to undefined method
Cannot redeclare function
Parse error
These errors can reveal exactly which file caused the problem.
For example:
/wp-content/plugins/example/includes/class-example.php
indicates that the error may originate from that plugin.
A message such as:
Allowed memory size exhausted
points toward a PHP memory problem.
A:
Parse error
usually indicates invalid PHP syntax.
8. Check Recently Added Custom PHP Code
If the critical error appeared immediately after adding PHP code, the new code should be one of the first things you investigate.
Common locations include:
/wp-content/themes/your-theme/functions.php
and custom plugins.
Common coding mistakes include:
- Missing semicolons
- Missing brackets
- Incorrect function names
- Duplicate functions
- Invalid PHP syntax
- Calling functions that do not exist
- Using code incompatible with the current PHP version
Restore the previous working version of the code and test the website again.
9. Check the functions.php File
The active theme’s functions.php file is loaded when WordPress initializes the theme.
A single PHP syntax error can prevent the site from loading.
If you recently edited this file, undo the change.
Alternatively, temporarily switch to a default WordPress theme. If the website starts working, inspect the theme’s functions.php file and other custom theme code.
10. Update WordPress, Plugins, and Themes
Outdated software can create compatibility problems.
Once access to the dashboard is restored, update:
- WordPress core
- Plugins
- Themes
Before updating major components, create a complete backup.
If the critical error appeared immediately after an update, identify the component that changed and check whether a newer compatible version is available.
11. Clear WordPress and Server Caches
Caching normally does not cause a PHP fatal error, but stale cached content can make troubleshooting confusing.
Clear:
- WordPress cache
- Server cache
- Object cache
- CDN cache
- Browser cache
Then test the website again using a private browser window.
12. Check the .htaccess File
On Apache servers, a damaged .htaccess file can cause website problems.
Create a backup first, then temporarily rename:
.htaccess
to:
.htaccess-backup
Test the website.
If the site works, log in to WordPress and go to:
Settings → Permalinks
Click Save Changes to generate new rewrite rules.
If the site uses custom .htaccess rules, preserve and review those rules before replacing the file.
13. Check WordPress Core Files
A failed update or corrupted files can result in critical errors.
If you suspect WordPress core files are damaged, download a fresh copy of the same WordPress release and replace the core directories:
wp-admin/
wp-includes/
You can also replace the WordPress root files while preserving your site’s configuration.
Do not casually overwrite:
wp-content/
because it contains your plugins, themes, uploads, and other website data.
Also preserve your existing:
wp-config.php
unless you intentionally need to replace or repair it.
14. Check Server Resource Limits
A critical error can occur when your website reaches hosting limits.
Check your hosting control panel for:
- CPU usage
- RAM usage
- PHP workers
- Entry processes
- Disk space
- I/O usage
- Inode usage
High traffic, inefficient plugins, background tasks, and poorly optimized websites can consume excessive resources.
If the website regularly reaches its hosting limits, increasing WordPress’s memory setting alone may not solve the underlying problem.
15. Disable a Problematic Plugin Manually
Sometimes you already know which plugin is causing the problem but cannot access the dashboard.
Open:
/wp-content/plugins/
Find the suspected plugin directory.
For example:
/wp-content/plugins/example-plugin/
Rename it:
/wp-content/plugins/example-plugin-disabled/
WordPress will no longer load that plugin.
If the website starts working, leave the plugin disabled until you can update, replace, or troubleshoot it.
16. Check for Plugin and Theme Compatibility
Not every plugin works correctly with every WordPress, PHP, and theme combination.
Before installing or updating software, check:
- Supported WordPress versions
- Supported PHP versions
- Last update date
- Plugin compatibility information
- Known conflicts
Avoid using abandoned plugins on important production websites.
17. Check the Database if the Error Mentions SQL
Some critical errors are triggered by database-related operations.
Review the error log for messages involving:
- SQL syntax
- Missing tables
- Unknown columns
- Database connection failures
- Failed queries
If the problem began after installing a plugin, the plugin may have created or modified database structures incorrectly.
Do not manually delete database tables unless you know exactly what they contain and have a backup.
18. Check Your Hosting PHP Configuration
Some PHP settings can affect whether WordPress and its plugins operate correctly.
Depending on the application, review settings such as:
memory_limit
max_execution_time
max_input_vars
max_input_time
upload_max_filesize
post_max_size
The correct values depend on the website and hosting environment.
If you do not have access to PHP configuration, ask your hosting provider to review the PHP error log and resource limits.
19. Restore a Recent Backup
If the critical error appeared immediately after a major change and you cannot identify the cause, restoring a known-good backup may be appropriate.
Before restoring:
- Preserve the current website if possible.
- Create a backup of the current state.
- Identify the most recent working backup.
- Restore the backup.
- Test the website.
- Determine what caused the original error before making the same change again.
For ecommerce websites, be particularly careful because restoring an older database can remove newer orders, customers, or other transactional data.
20. Troubleshoot the Error Based on Its Message
The exact error message can often tell you where to look.
“Allowed memory size exhausted”
Usually indicates insufficient PHP memory or excessive resource usage.
Check:
- PHP memory limit
- Plugins
- Themes
- Server resources
“Call to undefined function”
Usually indicates missing functionality, incompatible code, or a plugin/theme requiring something that is unavailable.
Check:
- Plugin or theme compatibility
- PHP version
- Missing PHP extensions
“Cannot redeclare function”
Usually indicates that the same function has been declared more than once.
Check custom code and recently installed plugins.
“Parse error”
Usually indicates invalid PHP syntax.
Check the file and line number reported in the error log.
“Class not found”
Often indicates:
- Missing plugin files
- Incomplete updates
- Incorrect autoloading
- Plugin compatibility issues
“Allowed memory size exhausted”
This commonly occurs when PHP exceeds its configured memory limit. Check both WordPress memory settings and the server’s PHP configuration.
21. Use a Staging Website for Future Changes
If your website frequently experiences critical errors after updates or code changes, use a staging environment.
A staging website allows you to test:
- WordPress updates
- Plugin updates
- Theme updates
- PHP version changes
- Custom code
before applying them to your live website.
This is especially useful for WooCommerce and other websites where downtime can directly affect customers.
Quick Troubleshooting Checklist
Use this checklist when WordPress displays a critical error:
☐ Check the WordPress Recovery Mode email
☐ Enable WP_DEBUG_LOG
☐ Review wp-content/debug.log
☐ Check the PHP error log
☐ Disable all plugins
☐ Identify the problematic plugin
☐ Switch to a default theme
☐ Check recent theme/custom PHP changes
☐ Verify the PHP version
☐ Increase PHP/WordPress memory if necessary
☐ Clear caches
☐ Check .htaccess
☐ Check WordPress core files
☐ Check hosting resource limits
☐ Review database-related errors
☐ Restore a known-good backup if necessary
How to Prevent WordPress Critical Errors
A few maintenance practices can greatly reduce the risk of critical errors:
- Keep WordPress updated.
- Use supported PHP versions.
- Keep plugins and themes updated.
- Remove abandoned plugins.
- Back up your website regularly.
- Test major updates on staging first.
- Avoid unverified PHP code.
- Monitor server resources.
- Review error logs regularly.
- Use plugins from reputable developers.
- Avoid installing multiple plugins that perform the same function.
Conclusion
A WordPress Critical Error is usually the result of a PHP fatal error, plugin conflict, theme problem, incompatible PHP version, memory limitation, or faulty custom code.
The best approach is to avoid guessing and identify the underlying error first. Start with the Recovery Mode email and WordPress debug log, then test plugins, themes, PHP compatibility, memory limits, and recent code changes.
Once you identify the component responsible, update, replace, or correct it rather than repeatedly restoring the website. Regular backups and a staging environment can also make future troubleshooting much safer and faster.

