Does anyone know the steps needed to add a custom format to the blockformat (p,h1,h2,h3 etc.) dropdown in the tinyMCE editor in Wordpress?

I've found a lot of different ways to do that, which seem to either contradict each other or have absolutely no effect.

I've had very little interaction with Wordpress as a developer so I'm not even sure where what is located. wordpress tinymce

1 Answer 1

function extend_tiny_mce_defaults( $config )
    // comma separated list of any block-level HTML tag
    $config['theme_advanced_blockformats'] = 'h1,h2,h3,h4,h5,h6,p,code,address';
    return $init;
add_filter( 'tiny_mce_before_init', 'extend_tiny_mce_defaults', 100 );
  • Where does that go, and does that method allow me to add a custom block format of my design?
    – VikingGoat
    Jan 8, 2012 at 20:13
  • Drop it in a plugin or your theme's functions.php. As for your 'custom' block format, if it's not just a standard HTML element (i.e. you want it to do a little more) you might be better off implementing a custom Tiny MCE button instead. Jan 8, 2012 at 23:48
  • I ended up installing Advanced TinyMCE Configuration and Advanced TinyMCE Configuration, was working great until I updated 3.3 and now style doesn't get rendered in the editor, but other wise works fine.
    – VikingGoat
    Jan 9, 2012 at 3:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.