thumb

If you were trying something new on your WordPress website and after editing/entering custom code on the settings page of the plugin Custom Code Manager your website becomes inaccessible, you may decide to delete the plugin manually (via FTP) and install it again, but then you will run into the fact that the plugin could not be activated because it triggered a fatal error. In this article I will show you how to activate the plugin without errors and fix the error in your custom code that you entered on the plugin settings page.

If you are using the “My Custom Functions” plugin instead, please read my other article here.

What causes this error

The Custom Code Manager 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):

Plugin could not be activated because it triggered a fatal error.
Parse error: syntax error, unexpected '}' in /wp-content/plugins/custom-code-manager/sub/php/inc/php/functional.php(85) : eval()'d code on line 12

In the example of the error message above, it is reported that the plugin can not be activated due to an error. It 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.

  1. 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.

  2. Browse to the directory wp-content/plugins/custom-code-manager/.

    The location of the folder wp-content depends on your host’s setup. Typically, the folder public_html contains 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.

  3. Rename the file START to STOP. This will stop the execution of your custom PHP code that is causing the error. Now your website should be returned to life and the WordPress Admin Area should be accessible.
  4. Log in to Admin Area of your WordPress website.
  5. Go to the Plugins -> Installed Plugins.
  6. Find the plugin in the list of installed plugins and click the Activate button below. Now the plugin should activate without errors.
  7. Go to the plugin settings page Code -> PHP code.
  8. Edit/fix your custom PHP code that you entered before the crash.
  9. Return to the plugin folder and rename the file STOP to START.

Conclusion

That’s it, you’re done. You’re now have the plugin activated without errors. So simple isn’t it?

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 you are having trouble fixing this problem with the instructions above, but are being able to solve this problem with any another method please describe it in the comment section below. Thanks!

If this article has helped you solve the problem then please leave a comment :smiley:

Thanks for reading!