I want to remove the headings options from Wysiwyg in a custom field that is set ix certain custom post type. Is there a way to archive it?
1 Answer
You can generally edit the capability of the tinyMCE WYSIWYG Editor for ACF with the acf/fields/wysiwyg/toolbars
hook.
By default the WYSIWYG editor has two toolbars, "Full" and "Basic" but you can also create you own(see docs)
Removing the formatting option for the "Full" WYSIWYG editor can be accomplished like this:
add_filter( 'acf/fields/wysiwyg/toolbars' , 'my_toolbars' );
function my_toolbars( $toolbars )
{
// Edit the "Full" toolbar and remove 'code'
// - delet from array code from http://stackoverflow.com/questions/7225070/php-array-delete-by-value-not-key
if( ($key = array_search('formatselect' , $toolbars['Full' ][2])) !== false )
{
unset( $toolbars['Full' ][2][$key] );
}
}
SRC: https://www.advancedcustomfields.com/resources/customize-the-wysiwyg-toolbars/