If you were trying something new on your WordPress website and after editing/entering custom code on the settings page of the plugin My Custom Functions your website becomes inaccessible, then don’t panic. You are not the first one to face this situation. In this article I will show you how to get your website return to life and fix the error in your custom code.
What causes this error
The My Custom Functions plugin has a built-in functions for checking the custom PHP code for syntax errors, duplicate functions names, and etc. But plugin is not perfect, so there are times when the entered custom code causes the error and white screen (WSOD). This is due to the fact that the custom PHP code that user entered on the plugin settings page has a syntax error that the plugin could not detect.
Did you recently paste a snippet from the web or updated an existing snippet? Then chances are you know exactly where to look. Most likely the problem is a syntax error. The syntax error is usually caused by a tiny but crucial mistake in your custom PHP code syntax. A missing comma, or an extra curly bracket can break the entire site. Due to this mistake, you now getting a white screen (WSOD) and the following error message (an example):
Parse error: syntax error, unexpected '}' in /wp-content/plugins/my-custom-functions/inc/php/functional.php(85) : eval()'d code on line 12
The above example of the error message indicates a syntax error (an extra symbol
}) on line 12 of the custom PHP code that user entered on the plugin settings page.
How to solve it
To solve this problem all you need to do is fix your custom PHP code that you entered on the plugin settings page before the crash. Despite the fact that the website does not respond and you can not get into the Admin Area, you can still edit your custom PHP code. For this, please perform the following steps.
- Access your server via FTP or SFTP.
If you aren’t sure how usually your web hosting provider will have instructions somewhere on their website.
- Browse to the directory
The location of the folder
wp-contentdepends on your host’s setup. Typically, the folder
public_htmlcontains all the files of the website, among which you will find this folder. Please contact your web hosting company to get help if you can’t find this folder.
- Rename the file
STOP. This will stop the execution of your custom code. Now your website should be returned to life and the WordPress Admin Area should be accessible.
- Log in to Admin Area of your WordPress website.
- Go to the plugin settings page
- Edit/fix your custom PHP code that you entered before the crash.
- Return to the plugin folder and rename the file
And that’s all. You’re now have your website working again.
We are already working on a feature to automatically stop the execution of users custom PHP code for cases when this plugin could not detect the error, and this caused the inaccessibility of the website.
If this article helped you solve the problem then please leave a comment.
Thanks for reading!