Remove headings option from Wysiwyg editor from ACF in a certain custom post type

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?

Topic advanced-custom-fields wysiwyg Wordpress

Category Web


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/

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.