When modifing the wysiwyg editor, is it possible to change the content of formatselect ?
Hi @PerS
Could you please elaborate a bit more on what ‘formatselect’ select is? I’m not familiar with this.
Thanks
E
formatselect is the pull down list in the editor with h1,h2,h3 ..
Hi @PerS
Thanks for clarifying.
I know that this is possible using a filter on all WP WYSIWYG called ‘tiny_mce_before_init’, but this will be applied to all fields, not specific ACF fields…
I found this article on stack exchange which may be a good starting point:
http://wordpress.stackexchange.com/questions/3882/can-i-add-a-custom-format-to-the-format-option-in-the-text-panel
Good luck
Thanks
E
Thank you, this is what I needed:
add_filter('tiny_mce_before_init', 'wpse3882_tiny_mce_before_init');
function wpse3882_tiny_mce_before_init($settings) {
$settings['theme_advanced_blockformats'] = 'p,h1,h2';
return $settings;
}
This doesn’t seem to work for ACF WYSIWYG’s – is there another solution?
For anyone struggling with this, post WP 3.9 you’ll have to do this:
add_filter( 'tiny_mce_before_init', function( $settings ){
$settings['block_formats'] = 'Paragraph=p;Heading=h2;Subheading=h3';
return $settings;
} );
Hi there,
The snippet that darrengrant posted works great:
add_filter( ‘tiny_mce_before_init’, function( $settings ){
$settings[‘block_formats’] = ‘Paragraph=p;Heading=h2;Subheading=h3’;
return $settings;
} );
Though it applies to all wordpress wysiwyg’s. Is there a way to limit it to ACF wysiwyg fields only?
Cheers,