Troubleshoot & Fix Theme Errors

Troubleshoot & Fix Theme Errors

Knowing Common WordPress Issues & Knowing How to Get Thru Them Intuitively Is The Art

tenor

By The Hitchhiker

Troubleshoot and fix theme errors in WordPress

From time to time, a WordPress theme can cause an error or issue with your site. The issues may appear as a fatal, syntax, or sidebar error, a white screen, or a missing style sheet, among others. You have two options when troubleshooting and fixing theme errors on your site:

  • Reach out to me & I can do it for you for a fee.
  • Do it yourself following the instructions in the tables below.

WEBSITE TECH SUPPORT

Nerd of Fortune can perform the following Theme related services for you for a fee:

Do it yourself

To diagnose and troubleshoot a WordPress theme, complete the following:

ProcessDifficulty
Troubleshoot theme errors in WordPressMedium
Setup PHP error loggingMedium
Fix theme errors in WordPressMedium
Check cross browser compatibility for WordPressMedium

Troubleshoot Theme Errors in WordPress

Troubleshoot theme errors in WordPress

WordPress theme errors can result in error messages or blank white pages, which is commonly referred to as a white screen of death. You can use the steps below to diagnose potential WordPress theme errors.

Prepare your WordPress site for troubleshooting:

  1. You should always backup your site before performing any troubleshooting.
  2. Disable all plugins, especially any caching plugins.
  3. If your site uses wp_cache, you will need to disable WP_CACHE.

Look for a theme related error

  1. Enable WordPress debug mode.
  2. Visit your site and check to see if there is a PHP error.
  3. If there is a PHP error, check to see if the themes directory is in the file path. Below is an example:
    Fatal error:  Call to undefined function functionName() in
    /home/wp-content/themes/twentyeleven/functions.php on line 1
  4. If the file path contains themes, then this confirms the issue is with the theme, and you can move on to fixing the error.
  5. If the error is not visible on your website, then you will need to expose the error:
  6. If the detailed errors or logs show a PHP error, then you can begin fixing it.

Determine if the error only occurs with your currently active theme

  1. Connect to your hosting with FTP to upload files.
  2. Navigate to the directory containing your WordPress site.
  3. Then open the wp-content/themes directory.
  4. Make note of the latest default theme that is installed.

    Note: Default WordPress themes are named after the year they were released. For instance, the default theme that came out in 2017 is named twentyseventeen.

  5. Update your WordPress site to use a default theme in the database.
  6. Check your site. If the issue is no longer persisting, then you have successfully determined the issue is with your non-default theme.

Next steps

More Info:

Setup PHP error logging

PHP error logging

When troubleshooting PHP errors, you will want to review your PHP logs. If you don’t have PHP logs to review, use the following process to set up logging:

Note: For WordPress and Managed WordPress error logging please see Enable debugging to display errors in WordPress.

  1. You should always backup your site before making any changes to your site.
  2. Locate your PHP initialization file.
  3. Edit the file. (cPanel / Plesk / VPS)
  4. Place the following line in your initialization file:
    error_log = /path/to/your/webroot/php_error.log
    • error_log is the PHP function that will tell the web server to output your logs to a new file.
    • /path/to/your/webroot/php_error.log is the path to your new log.
      • Make sure to replace /path/to/your/webroot with the actual path your hosting account uses.
      • What is my absolute path? (cPanel / Plesk).
  5. Create the a file named php_error.log in the in the webroot of your hosting.
  6. Restart your PHP processes.(cPanel / Plesk).

Fix theme errors in WordPress

Fix theme errors

After troubleshooting your site to determine the error, you can attempt to fix your theme and return your site to a working state.

Understanding a WordPress related PHP error

If your previous troubleshooting revealed a PHP error, use the following table to help understand the error.

Error typeDefinition and Next Steps
E_ERRORThis is a fatal error that causes script termination. These typically are caused by calling a non-existing object like a class or function. This can often occur in version incompatibility. Your next steps should be to update your WordPress version, themes, and plugins.
E_WARNINGA run-time warning does not cause script termination. These are potential issues that occur but do not stop the processing of PHP. These can often include deprecation warnings, which indicates that your code may be using an outdated version of PHP and needs to be updated. A warning in your PHP logs may not necessarily be related to the issue you are experiencing.
E_PARSEThis is a compile time parse error. It is usually indicative of a PHP syntax error, such as a missing semicolon ;, parenthesis (), or opening or closing bracket {}, or any number of other syntax errors. You should review the file and line specified in the error message and look for potential syntax error.
E_NOTICEThese are typically PHP errors that don’t cause script termination. They indicate that there could be an issue, but may be part of the normal running of the script. A common cause is using a PHP variable that is undefined. A notice in your PHP logs may not necessarily be related to the issue you are experiencing.

 

Update your WordPress components

When your WordPress version, theme, or plugins are updated, they may develop a conflict with the other components that have not been updated. Updating the other components can restore your site. See the following to update a component of your site:

White screen with no PHP error

If you have a white screen of death, and your troubleshooting did not reveal a PHP error, then check the following:

  1. Make sure your wp-content/themes directory is present.
  2. Confirm the permissions are correct for the wp-content and themes directories.
  3. Confirm the directory for your active theme also has the correct permissions.
  4. Make sure the directory for your active theme has files present in it.
  5. Check to see if there is a default theme also present in the wp-content/themes directory. WordPress will automatically load the default theme in the event the active theme is not present.
  6. Confirm the index.php file in the root directory is not missing or blank.
  7. Confirm your theme’s index.php file is not missing or blank.

Check cross browser compatibility for WordPress

Check cross browser compatibility for WordPress

Cross browser compatibility issues in WordPress are typically CSS related. You will often notice this issue when browsing your site and certain elements aren’t in the right place, do not appear to resolve properly, or simply don’t load at all.

Older WordPress websites could run into issues with cross browser compatibility. Due to strict plugin and theme requirements you are less likely to find any current plugins or themes with this issue.

The Microsoft Edge browser will easily help you run cross browser compatibility checks on your site.

  1. Open the Edge browser.
  2. Use the browser to navigate to your website.
  3. Press the F12 key to load the Developer Tools.
  4. In the window that pops up, click on the Emulation tab.
  5. Under User agent string, select the version of browser you want to test.

    Note: A great place to start is IE 8, since is this an outdated browser that is still commonly used.

  6. Review your site and note any inconsistencies.
  7. Repeat steps 5 and 6 as needed with the browsers you suspect have issues.

Since WordPress itself is already optimized for cross browser compatibility, your list of inconsistencies should point to a theme or plugin that is causing the issue.

Post Author: The HitchHiker

Leave a Reply