0

I have a particular post type where I want the editor's default format block to be H3. So, when you create a new empty post and begin typing in the editor, the text would automatically default to being an H3.

Currently the default is set to be a Paragraph, which means even if I create some text and set it to be Heading 3 (H3), when I create a new line the block format automatically goes back to Paragraph, too.

As a test, I even removed all the block formats except for H3, but that didn't work—the block format dropdown displays "Heading 3," but the text is still formatted as a paragraph (<p>).

To be clear, I do still want control over the block format. I just want to be able to change the default.

Here's my failed attempt to remove everything except H3:

function set_h3_default($init) {
  $block_formats = array(
    'Heading 3=h3',
  );
  $init['block_formats'] = implode(';', $block_formats);

  return $init;
}
add_filter('tiny_mce_before_init', 'set_h3_default');

  • TinyMCE Configuration options reference -> Content formatting options – Max Yudin Mar 8 at 16:33
  • @MaxYudin where is the default block format documentation there? – cfx Mar 8 at 20:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.