Wordpress Fatal Error continue Not in the loop or switch Context
This tutorial is part of our FREEWordPress Management training and WordPress Troubleshooting tutorial series.
In this series of step-by-step tutorials, we show you how to troubleshoot and fix common WordPress errors.
Important: Always back up your WordPress site (files and data) before modifying any files or performing any upgrades or installations!
If you don't want to do your own backups, then consider using professional WordPress help services, or use WordPress backup plugins.
Issues with WordPress can result in a number of "fatal error" messages being displayed on your screen. Here are some of the more common WordPress fatal errors you may come across and how to resolve these:
Fatal Error: Issue With A Plugin
Typically, if an error occurs within a plugin, such as a conflict between an outdated plugin becoming incompatible with a newer version of WordPress for example, you may get a "Fatal Error" message that can affect your entire site …
In the example below, the 'Fatal error' clearly indicates that the error is caused by an incompatible plugin, and it also tells you which plugin is causing the error …
To fix this error, all you need to do is deactivate the offending plugin.
To deactivate the plugin, log into your server using FTP or cPanel and locate your WordPress installation's plugin folder. For this example, we'll deactivate the plugin using cPanel's File Manager.
Find the plugin that is causing the error, then select the plugin folder and click rename (if using cPanel's File Manager – if using FTP, right-click on the file and select 'Rename') …
Rename the file by adding anything after the plugin folder name (e.g. 'old') and click on 'Rename File' …
Confirm that the plugin has been renamed and exit cPanel (or FTP) …
Go back to your browser and refresh or revisit your website's page. Your site should be restored to normal …
If you log into your site, you may see a message informing you that the plugin has been deactivated due to an error and that the plugin file no longer exists. Refresh your page to dismiss the error message …
Now that you have restored your site to normal, delete the plugin from your site and notify the plugin developer of the error. Hopefully, they will address the problem and issue a new update with a solution.
If you have multiple WordPress sites using the same plugin, remember to check them all to make sure that they are still up and running.
To learn more about errors caused by plugins and how to fix these, go here:
Fatal Error: Call to undefined function
This error means that a plugin or a theme is expecting to find something that isn't there – hence the undefined function. It could happen for a number of reasons:
- An error during auto-upgrade. If this happens you should upgrade manually.
- An error during auto-install. Again, if this happens reinstall manually.
- A plugin or theme is incompatible with your version of WordPress. This usually happens with older versions of WordPress and new plugins. It may also be that you're trying to install a plugin that is only compatible with a certain type of setup (e.g. Multisite). If it happens while installing a plugin, disable the plugin using FTP.
To learn more about using FTP and transferring files between your computer and your server, go here:
Fatal Error: Allowed Memory size exhausted
(Fatal error: Allowed memory size exhausted)
This error occurs when the amount of memory allocated to WordPress isn't enough to perform the task required by a feature or plugin that you have installed on your site. Hosts typically set a server limit for PHP memory to one of the following amounts: 32, 64, 128, 256, or 512 MB.
Note: Exceeding your PHP memory limit can also lead to a 500 Internal Server Error.
To fix this error you need to increase the amount of memory that WordPress can use. To do this you will need to either edit your wp-config.php file or your php.ini file.
Edit wp-config.php File
The wp-config.php file is located in your WordPress installation directory and can be accessed via FTP or using cPanel's File Manager …
(wp-config.php file)
If you need help accessing files on your server, see this tutorial:
To edit wp-config.php, download the file to your hard drive, then open up the file using a plain text editor and add the following line:
… or change the current setting to a higher limit (e.g. '256' or '512') …
(Increase memory limit in your wp-config.php file)
After editing and resaving your wp-config.php file, reupload the file to your server overwriting the existing file.
Edit php.ini File
Editing your php.ini file is a bit more complicated as it's not a file that comes with WordPress but is part of your hosting account.
A php.ini file is the default file for configuring and running applications that require PHP. The server looks for this file when PHP starts up for instructions on how to control variables such as upload sizes, file timeouts, and resource limits.
If your server contains a php.ini file, you can access it using FTP or cPanel's File Manager …
(php.ini)
Download a copy of your php.ini file to your hard drive, then open it using a plain text editor …
(Open your php.ini file using a plain text editor)
Note: To locate and open the php.ini file in your plain text editor, make sure that 'All files (*.*)' is selected in the 'Files of type:' drop-down menu.
This file should contain a simple instruction for setting the PHP memory limit …
(PHP memory limit)
Increase the memory limit amount (e.g. from 64M to 128M or 256M) …
(Increase PHP memory limit amount)
Resave the php.ini file and reupload the file to your server overwriting the existing file.
If you don't have access to your php.ini file, contact your hosting provider to make changes, or see this tutorial:
You may also want to try adding the line of code below to your .htaccess file and see if this solves the issue:
Fatal error: Maximum execution time
Open up your wp-config.php file and add the following line:
set_time_limit(0);
You can add the line shown above anywhere in the file, even right after the opening comment block, as shown in the example below:
After making the adjustment, retry the automatic update.
How To Fix WordPress Errors – Videos
In addition to the information above, here are a couple of videos on how to fix WordPress "fatal" errors from the team at MyThemeShop:
How To Fix WordPress Memory Exhausted Error
(How to fix WordPress memory exhausted error. Video: MyThemeShop)
How To Fix WordPress Fatal Error: Maximum Execution Time Exceeded
(How to fix WordPress fatal error: Maximum execution time exceeded. Video: MyThemeShop)
More WordPress Troubleshooting Tutorials
Check out the tutorials in the section below if you experience any other problems or errors with WordPress:
(Source: Pixabay)
***
"I was absolutely amazed at the scope and breadth of these tutorials! The most in-depth training I have ever received on any subject!" – Myke O'Neill, DailyGreenPost.com
Disclaimer: This site has no association with WordPress, Automattic, or any of the WordPress-related products mentioned on this website. We may receive financial benefits or affiliate commissions from purchases of any products advertised on this site. All images are the copyright of their respective owners and comply with all license terms and agreements of use.
***
Did you enjoy this tutorial? If so, please consider sharing this tutorial with others using the links below.
Source: https://wpbrainery.com/wordpress/how-to-fix-wordpress-fatal-errors/
Post a Comment for "Wordpress Fatal Error continue Not in the loop or switch Context"