How to re-enable the Customizer in a block theme

Level: ,

Estimated reading time: 2 minutes

You probably already know that activating block themes removes the Customizer from the menus in the WordPress admin. The Customizer is still a part of WordPress, and you can re-enable the links with just one line of code.

I am mentioning this mostly as an assurance: If you -or your users- activate a plugin that uses the Customizer, like Yoast SEO or WooCommerce, then WordPress will re-enable the Customizer links automatically. In this case you don’t need to make any changes to the theme, and you don’t need to worry about compatibility.

Re-enable the Customizer with the customize_register hook

The other way to re-enable the Customizer is to use the customize_register hook. Add the hook to your theme, for example in the functions.php file.
Just like with the plugin example, WordPress will add the links automatically. You do not need to make any code changes for the admin menu or the admin bar itself.

Consider this option if your users are struggling with learning how to use the Site Editor. You can also use it if you want to enable the Additional CSS option, a feature that is otherwise missing.

You can register actual Customizer options for your block theme. Or you can use return true as the callback for add_action(). -Either way, the action must include a callback, or it will cause a fatal PHP error. Example:

add_action( 'customize_register', '__return_true' );