Is there a way to disable the edit shortcut buttons that was added in WordPress 4.7?

I noticed they have a class customize-partial-edit-shortcut-button and I can add display:none in css but trying to find a solution in php.

enter image description here

2 Answers 2


The simplest way to disable edit shortcuts without unwanted side effects is to no-op override the JS function that generates them in the first place. You can do this from PHP as follows:

add_action( 'wp_enqueue_scripts', function () {
    $js = 'wp.customize.selectiveRefresh.Partial.prototype.createEditShortcutForPlacement = function() {};';
    wp_add_inline_script( 'customize-selective-refresh', $js );
} );

This will work for any theme.


This featured is enabled by just adding theme support feature. Here is the code

add_theme_support( 'customize-selective-refresh-widgets' )

You can find this in functions.php file and remove this line of code to disable the feature or you can add a hook to deactivate it like the code below and place that code at the end of functions.php file.

remove_theme_support( 'customize-selective-refresh-widgets' ); 

This will deactivate the front end edit shortcut support for your theme.


To remove this support from twenty seventeen theme you have to remove that function which is making live edit support and partial refresh section. And for other theme you have to find out that function inside functions.php file. In this case here is the code solution.

remove_action('customize_register', 'twentyseventeen_customize_register' );

place this code at the end of functions.php file and you are done.

  • It looks like remove_theme_support( 'customize-selective-refresh-widgets' ) does not work even after removing add_theme_support( 'customize-selective-refresh-widgets' ). I tried in the Twenty Seventeen theme. Jan 17, 2017 at 8:44
  • just looked into twenty seventeen theme and found solution check the updated answer above. Jan 17, 2017 at 10:43
  • Removing twentyseventeen_customize_register will have unintended side effects. Jan 18, 2017 at 8:02
  • @WestonRuter I think the person better knows what he is trying to do and he is aware of the risks of doing so. He is trying and experimenting with PHP code. If you can read his question carefully. Jan 18, 2017 at 8:09
  • If you unregister twentyseventeen_customize_register then you'll no longer get selective refresh previews of the site title and tagline. You'll also not get any of the theme-specific sections, controls, and settings. That seems like a non-starter to me. Jan 18, 2017 at 18:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.