How to re-enable the Customizer in a block theme

Level: ,

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.

Estimated reading time: 1 minute

Last updated

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.

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' );