Here we will cover what to do when WordPress is showing the following critical error:
Fatal error: 'break' not in the 'loop' or 'switch' context in /home/cpuser/public_html/wp-content/themes/themename/lib/functions/template-tags.php
on line 333
This is typically a PHP error that is caused by an incompatible PHP version.
The PHP version will have to be downgraded to resolve this error.
Related Articles
Enable/Disable Error Reporting in PHP
Enable and Configure Debugging for WordPress
Downgrade PHP Version
NOTE: This issue generally occurs when the website's PHP version is greater than 5.6.
- Log into cPanel
- Navigate to MultiPHP Manager, located in the Software section
- Select the domain by clicking the Checkbox to the left of the domain
- From the PHP Version drop-down menu, select a PHP version ≤ 5.6
- Click Apply
IMPORTANT: PHP versions ≤ 7.3 are deprecated. It is not recommended to keep the website on this version, it is important to update all software on the website to ensure that a greater PHP version can be used.