• Resolved Bloxxor

    (@fsmoffice)


    Hi there,

    I can’t disable the customizer for AMP. Documentation on github says:

    add_filter( ‘amp_customizer_is_enabled’, ‘__return_false’ );

    Note that this needs to be called before the after_setup_theme hook to work.

    I tried several hooks (muplugins_loaded, init, after_setup_theme with highest priority), placing the filter at first in functions.php but the Menu-Entry “Appearance > AMP” ist still visible.

    Thanks in advance

    • This topic was modified 7 years, 1 month ago by Bloxxor.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Weston Ruter

    (@westonruter)

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

    Plugin Author Weston Ruter

    (@westonruter)

    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.

    Plugin Author Weston Ruter

    (@westonruter)

    Agreed. I’ve opened an issue for this: https://github.com/Automattic/amp-wp/issues/1069

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Disabling the customizer’ is closed to new replies.