Support

Account

Home Forums ACF PRO Remove buttons from Editor's Text mode

Helping

Remove buttons from Editor's Text mode

  • Hi Guys,

    I am using the editor field in a widget which i add via the Customizer and i am trying to change the buttons output from the Text mode using the ‘quicktags_settings’ filter:

    function filter_editor_quicktags( $qtInit ) {
       $qtInit['buttons'] = 'strong,em,block';
       return $qtInit;
    }
    add_filter('quicktags_settings', 'filter_editor_quicktags');

    This code changes the buttons in the editor across the whole admin: posts, pages and widgets.

    Is there a way to use this code, but target only the ACF editor field?

  • The quicktags_settings filter accepts 2 params, and that second one is $editor_id. Default value for native WP editor is content. ACF editor field, unsurprisingly, has the value of acf_content.

    
    function filter_editor_quicktags( $qtInit, $editor_id )
    {
    	if ( $editor_id === 'acf_content' ) {
    		$qtInit['buttons'] = 'strong,em,block';
    	}
    
    	return $qtInit;
    }
    add_filter( 'quicktags_settings', 'filter_editor_quicktags', 10, 2 );
    
Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Remove buttons from Editor's Text mode’ is closed to new replies.