Home Forums ACF PRO How to modify WYSIWYG toolbar settings?


How to modify WYSIWYG toolbar settings?

  • Hello world! And then straight to my question.

    ACF documentation menitones here that it’s possible to modify the TinyMCE toolbars used by ACF using the 'acf/fields/wysiwyg/toolbars' filter.

    I’ve had no problems with adding toolbar tools. I do it like this:

    /*== Modify the ACF WYSIWYF toolbar. ==*/
    function customize_acf_wysiwyg_toolbar( $toolbars ) {
      // Edit the "Full" toolbar and add 'fontsizeselect' if not already present.
      if (($key = array_search('fontsizeselect' , $toolbars['Full'][2])) !== true) {
        array_push($toolbars['Full'][2], 'fontsizeselect');
      // return $toolbars - IMPORTANT!
      return $toolbars;
    add_filter('acf/fields/wysiwyg/toolbars' , 'customize_acf_wysiwyg_toolbar');

    The above code adds a dropdown menu to select the font size in the WYSIWYG editor. What I want to do is to customize the font size options available in that dropdown and I don’t know how to do that.

    Can it be done using the same hook as the above example? If, how? I know that TinyMCE can be configured to do this.

  • I would also like to know how to edit the wysiwyg, but not only the toolbar!

    what i know is:
    because acf not use the default tinymce of wp-core (or at least use a own init method) some solutions that work with core didnt work with acf-wysiwyg fields.

    Additional/similar Topics to this thread (with no answer!)

  • For visual configuration purpose i would take a look at the tinymce advanced plugin. and about the font example you’ve asked for i would try something like that (untested)

    function tweek_mce( $init ) {
    	$init['fontsize_formats'] = "8pt 10pt 12pt 14pt 18pt 24pt 36pt";
    	return $init;
    add_filter('tiny_mce_before_init', 'tweek_mce');

    place it inside the functions.php. no acf needed in that particular case. best regards ralf

  • This worked for me:

    // Customize mce editor font sizes
    if ( ! function_exists( 'wpex_mce_text_sizes' ) ) {
    	function wpex_mce_text_sizes( $initArray ){
    		$initArray['fontsize_formats'] = "10px 12px 13px 14px 16px 18px 20px 22px 24px 26px 28px 30px 32px 34px 36px 38px 40px 42px 44px 46px 48px 50px";
    		return $initArray;
    add_filter( 'tiny_mce_before_init', 'wpex_mce_text_sizes' );

    Found here:

    How do you move the location of the font size drop-down menu on the tinymce toolbar, though?

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘How to modify WYSIWYG toolbar settings?’ is closed to new replies.