The theme customizer in WordPress is an awesome feature which makes it extremely easy to customize your website for example by placing widgets, changing colors, typography or else. But like with any other piece of software it can happen that the WordPress customizer just won't work. But don't worry, these kind of issues usually can be easily fixed!
What is the add_panel() error?
In WordPress 4.0 there have been added some awesome changes to the customizer. For example WordPress has introduced “Panels” to make it easy for theme developers to add custom panels to the WordPress customizer to have a separate panel for theme options:
But if you are running an outdated version of WordPress (before 4.0) and have installed a theme that has added panels to the customizer, you will have an issue because your older version of WordPress doesn't know about this new feature, which will result in an error, usually a blank screen in the customizer. There are several reasons why the customizer in WordPress can show a blank page, so if you want to check what the issue is, you could switch your WordPress installation to debug mode and if the issue is related to the panel, you usually will see an error like this for example:
Fatal error: Call to undefined method WP_Customize_Manager::add_panel() in /home/example/public_html/example.com/wp-content/themes/mh_newsdesk/includes/mh-options.php on line 19
IMPORTANT: Please don't forget to disable debug mode after you have checked the issue because otherwise there is a pretty good chance that errors or notices will also appear on the front end of your site. In general it's recommended to not enable debug mode on a live site, but to do this on a test site instead.
How to easily fix the add_panel() error?
As the error is caused by the outdated WordPress installation, obviously the only thing you'll need to do to fix the add_panel() error, is to update WordPress to the latest version. This usually can be achieved with a few clicks in your WordPress dashboard. After you have updated WordPress, the customizer will work as expected. But in case you still have issues with the customizer in WordPress after updating to the latest version of WordPress, you might want to have a look at this article: How to solve issues with the Theme Customizer.
This article also helped users with the following questions:
- Blank screen in theme customizer
- WordPress customizer shows blank page
- Customize theme in WordPress is not possible
- Theme customizer does not load
- Theme customizer shows add_panel() error
- How to fix issues with WordPress customizer