1

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 1

1

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/

Your Answer

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

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