@fsmoffice Please clarify by what you mean by disable. This filter in the plugin disables the AMP panel from being populated with the default sections.
The only thing I see it not doing which it perhaps should is remove the AMP admin menu item from being added under Appearance. For example:
--- a/includes/admin/functions.php
+++ b/includes/admin/functions.php
@@ -65,6 +65,11 @@ function amp_admin_get_preview_permalink() {
* Registers a submenu page to access the AMP template editor panel in the Customizer.
*/
function amp_add_customizer_link() {
+ /** This filter is documented in includes/settings/class-amp-customizer-design-settings.php */
+ if ( ! apply_filters( 'amp_customizer_is_enabled', true ) ) {
+ return;
+ }
+
$menu_slug = add_query_arg( array(
'autofocus[panel]' => AMP_Template_Customizer::PANEL_ID,
'url' => rawurlencode( amp_admin_get_preview_permalink() ),
In either case, the Customizer would be still enabled as a whole. It’s just a question of whether the default AMP sections are populating the Customizer.
Thread Starter
Bloxxor
(@fsmoffice)
@weston Ruter thank you for the detailed answer.
I thought this would also remove the menu entry. Like you said, the AMP Panel is not populated with the filter.
It should maybe remove the menu item, buy really the amp_customizer_is_enabled filter is not whether to disable the Customizer entirely but whether to disable the default AMP panel. Really in this case you should supply your own sections to populate the AMP panel to provide customizations to your templates.
Thread Starter
Bloxxor
(@fsmoffice)
Hi Weston,
of course it does not disable the whole customizer 😉
I think, this filter should disable the AMP customize menu entirely, if you are using custom templates there is no sense to have that menu there.