Removing buttons from the html editor

I’ve been searching the codex, and I’m probably overlooking something somewhere, but could someone tell if it would be possible to remove a button/quicktag from the WordPress html editor?

Related posts

Leave a Reply

2 comments

  1. With the quicktag_settings filter:

    function wpa_47010( $qtInit ) {
        $qtInit['buttons'] = 'strong,em,link,block,del,img,ul,ol,li,code,more,spell,close,fullscreen';
        return $qtInit;
    }
    add_filter('quicktags_settings', 'wpa_47010');
    

    The default is:

    $qtInit['buttons'] = 'strong,em,link,block,del,ins,img,ul,ol,li,code,more,spell,close';
    

    Though 'fullscreen' usually gets added too at the end. So I just deleted the 'ins' button.

    Edit to add:

    If you wish to create a custom button the following tutorial might help.

  2. I’m late to this party I know, but might I add that it’s better to be agnostic about the default buttons provided by WordPress. So instead of typing the buttons you want, I choose to remove the buttons I don’t want:

    function nmt_quicktags_buttons( $qt_init) {
        $del_buttons = array('del','ins','img','code');
        $qt_init['buttons'] = implode(',', array_diff(explode(',',$qt_init['buttons']), $del_buttons));
        return $qt_init;
    }
    

    Now if anyone at WordPress decides the quicktags-toolbar gets a new button, it will show up in your editor without a code change of your plugin/function.