A Practical Guide to Fixing Common Website Issues

With an estimated 500 websites being built on WordPress every day, it’s no wonder that there are more than 2,000 monthly Google Searches for how to fix critical errors. These errors can be confusing, time-consuming and annoying when you just need your website to work.

Whether you’re an experienced developer or new to WordPress, we have created a list of some handy fixes to keep your website running smoothly. If you’re still struggling or need some support, contact our team, who have the experience to rectify even the most complex of critical errors.

Move your problem to A staging environment

A critical error typically impacts only a section of your website rather than the whole thing. Although this step is optional, creating a staging environment for your website will allow you to investigate the issue in a controlled way with no live traffic.

You don’t want potential customers to see any code or file structures that might be displayed due to your debugging strategies. After all, you don’t want a critical WordPress error to impact your potential leads.

Before doing anything, it’s always a good idea to make a backup of your live site to ensure you can roll back if there is any further damage. You want to make things easier for future you and avoid any unnecessary downtime on your site.

What does your WordPress critical error message mean?

It might seem an obvious next step, but stop and take some time to read through the error message to understand what has gone wrong properly. Although these messages aren’t always the most straightforward, they often contain vital clues to the root cause of the error.

Note any phrases such as “critical error” or “fatal error” and any additional information that comes with these. This will be a good starting point and work as a general guide to help you find a solution.

Turn on WordPress debugging mode

Once you have a backup of the site, you’re using a staging environment and you have made a note of the important information in the error code, it’s time to start fixing the problem. You need to activate the WordPress debugging mode to help you get to the root of your critical error.

To do this, you need to find the wp-config. php file in the installation directory. You will need to open this using a text editor and then look for a line that reads:

define(‘WP_DEBUG’, false);

Change the value from “false” to “true” and then save the file, enabling the debugging mode. It’s important to note that this is not recommended if you are still working directly on your live site.

On your live site, an alternative would be to define the following:
/ Enable WP_DEBUG mode
define( ‘WP_DEBUG’, true );

/ Enable WP_DEBUG mode
define( ‘WP_DEBUG’, true );

// Enable Debug logging to the /wp-content/debug.log file
define( ‘WP_DEBUG_LOG’, true );

// Disable display of errors and warnings
define( ‘WP_DEBUG_DISPLAY’, false );
@ini_set( ‘display_errors’, 0 );

This would not allow any code or file structures to display on your live site, and the critical error stack trace can be accessed in wp-content/debug.log. However, as mentioned above, we wouldn’t recommend this as the best course of action.

Replicate the critical error

Once you have activated the debugging mode, you will need to cause the same critical error again. You can do this by repeating the same steps or navigating to the page that triggered your initial error.

By replicating the critical error, you can generate a more specific error message that will help you narrow down the problem. Adding this extra step will save you time in the future, as you’ll be armed with more information.

Review your error logs

Check your wp-content folder within the installation directory, where you’ll find a file called “debug.log. ” If you don’t, you’ll need to manually create one before trying to replicate the error.

In your debugging file, you’ll then need to carefully review the error logs to gather more information on the root of the issue. Take note of the most recent entries as they will likely hold lots of helpful information about the underlying problem.

Locate the problem

Fortunately, the error logs will usually narrow down the root cause of the problem right down to the line number along with a reason why that line of code doesn’t work.

For example, it might look something a little like this:
Fatal error: Uncaught Error: Call to a member function has() on null in /wp-content/themes/mysite/functions.php:1268 Stack trace: #0

In this instance, the critical error can be found on line 1268 in the functions.php file. The critical error has happened because the code contains () which is returning null when a value is expected.

Sometimes, the issue might be caused by a plugin for many issues. If this is the case, you can find this in the error path and correct it by disabling the plugin which is creating the problem.

If you need the plugin for some form of functionality on your website, you can contact the plugin’s owner for a solution. Alternatively, you could try and find another plugin with a similar functionality.

Deactivate plugins and themes

If your debugging log isn’t displaying correctly and an issue is still being shown, then it might be time to review your plugins and themes. Sometimes, a conflict between the two can cause a critical error.

Start by deactivating all of your plugins and switching to a default WordPress theme (like Twenty Twenty-One for example). You can then switch on each plugin one at a time and test your site slowly; if the error recurs, you know it’s a specific plugin causing the issue.

Once you’ve tried all of the plugins, try reactivating the original theme and see if this causes an issue. If the critical error reoccurs after this, then it’s likely your theme that is causing the error.

Check updates and compatibility

If you found a plugin or theme that caused the issue, you’ll need to see if it’s caused by your current version of WordPress and a lack of compatibility. You can start by reviewing the developer’s website or support forum to see if there are updates or patches.

Ensure you update the plugin or theme to the latest version and then test your website again. If the critical error is resolved, then great! If not, you should do some further investigating.

Are you still seeing a WordPress critical error?

It can seem disheartening when you face a critical issue on your website, and nothing you do seems to be resolving it. With a structured troubleshooting approach, you can work through the problem and get to the issue’s root.

To make things easier for yourself when these issues arise, follow best practices such as keeping regularly updated backups of your live site. This will give you a safety net to revert to if things do go wrong.

You can work through anything with perseverance and the right tools and processes. That said, don’t feel like you can’t ask for help if you’re still stuck.

Our team of developers has decades of experience giving WordPress support and will be able to find a solution to your problem. Contact us now to start ensuring our site operates to its full potential.