I'm working on a custom meta box and i am trying to limit the Block format tag to just P, H3 and H4 tags, i did it this way and not sure why it doesn't display the block format dropdown;
wp_editor( $content, 'fm_display_callback', array (
'media_buttons' => false,
'textarea_rows' => 5,
'quicktags' => array(
'buttons' => 'strong,em,del,ul,ol,li,close'
),
'tinymce' => array(
'toolbar1' => 'bold,italic,underline,bullist,numlist,alignleft,forecolor,aligncenter,alignright,link,unlink,undo,redo',
'toolbar2' => '',
'toolbar3' => '',
'block_formats' => "Paragraph=p; Heading 3=h3; Heading 4=h4",
),
) );
as listed on WordPress Codex, it doesnt work for some reason. I have as well tried making the block_formats
key into an array like this;
'block_formats' => array(
'Paragraph=p',
'Heading 3=h3',
'Heading 4=h4',
)
and like this;
'block_formats' => array(
'Paragraph' => 'p',
'Heading 3' => 'h3',
'Heading 4' => 'h4',
)
Not sure what i'm missing that is preventing the block format to display, as this is what i get visually (No dropdown)
I'm working on a custom meta box and i am trying to limit the Block format tag to just P, H3 and H4 tags, i did it this way and not sure why it doesn't display the block format dropdown;
wp_editor( $content, 'fm_display_callback', array (
'media_buttons' => false,
'textarea_rows' => 5,
'quicktags' => array(
'buttons' => 'strong,em,del,ul,ol,li,close'
),
'tinymce' => array(
'toolbar1' => 'bold,italic,underline,bullist,numlist,alignleft,forecolor,aligncenter,alignright,link,unlink,undo,redo',
'toolbar2' => '',
'toolbar3' => '',
'block_formats' => "Paragraph=p; Heading 3=h3; Heading 4=h4",
),
) );
as listed on WordPress Codex, it doesnt work for some reason. I have as well tried making the block_formats
key into an array like this;
'block_formats' => array(
'Paragraph=p',
'Heading 3=h3',
'Heading 4=h4',
)
and like this;
'block_formats' => array(
'Paragraph' => 'p',
'Heading 3' => 'h3',
'Heading 4' => 'h4',
)
Not sure what i'm missing that is preventing the block format to display, as this is what i get visually (No dropdown)
Share Improve this question asked Sep 10, 2019 at 19:02 Kolawole Emmanuel IzzyKolawole Emmanuel Izzy 2031 silver badge8 bronze badges1 Answer
Reset to default 2You need to add formatselect
in one of the toolbars, and WordPress by default have it in toolbar1
:
wp_editor( $content, 'fm_display_callback', array(
...
'tinymce' => array(
'toolbar1' => 'formatselect,bold,italic,...',
...
),
) );
Check this and https://www.tiny.cloud/docs-4x/configure/content-formatting/#block_formats.