I'm trying to remove the distraction free mode button from the editor, but i can't make it disapear.

Here is the code im using:

  add_filter( 'wp_editor_settings', function($settings) {
    $settings['quicktags'] = false;
    $settings['dfw'] = false;
    return $settings;

Is there something i'm missing? Because this works on the regular editor.


2 Answers 2


So after researching some wordpress filters i found the teeny_mce_buttons and removed the distraction free button with this function.

  function remove_teeny_mce_btns($buttons) {
    return $buttons;

    add_filter('teeny_mce_buttons', 'remove_teeny_mce_btns');

Here is the link with the solution:


function allow_distraction_free( $expand, $post_type ) {
    return false;

add_filter( 'wp_editor_expand', 'allow_distraction_free', 10, 2);

This tested and works as per https://developer.wordpress.org/reference/hooks/wp_editor_expand/ and via https://gist.github.com/jwondrusch/41130a421a2a70b0e697 found by googling 'disable distraction free mode'. The link offers example to tailor by post type.

EDIT: screenshot added from wp 4.9.9. alpha enter image description here

  • Hi, this code had a strange behavior, it had no effect on the teeny mode activated, and on normal tiny MCE mode it just changed the place the dfw button is. Aug 29, 2018 at 14:53
  • HI, I'm testing in 4.9.9 alpha with very few other plugins active and there is no distraction free button mixed in with the other buttons - only the one on the far right, which disappears with code above. Perhaps the button was also being added by other code adjusting the tiny-mce? Or it's a version thing. Let us know if you figure it out.
    – anmari
    Aug 30, 2018 at 6:12
  • Hi again, added screenshot above from wp 4.9.9 alpha. It looks like it is the same 'dfw' button, there is css absolutely positioning it in the top right.
    – anmari
    Aug 30, 2018 at 6:31
  • Hi, Thanks for the feedback, I think it may have something to do with some code that was changing the toolbar buttons. I didn't notice there was as "fullscreen" button there. So when i removed the dfw button it started to show this fullscreen one that appears to be the same thing. Aug 30, 2018 at 15:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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