Home › Forums › General Issues › Wysiwyg, formatselect
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
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,
The topic ‘Wysiwyg, formatselect’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.