Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have added custom tinyMCE button to editor, but I can't figure out how to add it to editor in ACF.

function mce_cta_button() {
    if ( is_admin() ) {
        add_filter( 'mce_external_plugins', 'custom_tinymce_plugin' );
        add_filter( 'mce_buttons', 'register_mce_buttons' );
    }
}
add_action('admin_head', 'mce_cta_button');

I have tried to add this:

add_filter( 'acf/fields/wysiwyg/toolbars' , 'my_toolbars'  );
function my_toolbars( $toolbars )
{
    return array();
}

then it works, but I get error:

Warning: array_unshift() expects parameter 1 to be array, null given in .../themes/behold-standard/libs/others.php on line 50

Warning: implode(): Invalid arguments passed in .../plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-wysiwyg.php on line 176

in others.php file I have this script:

function customToolbars( $toolbars ) {
    array_unshift( $toolbars ['Basic'][1], 'fontsizeselect', 'forecolor', 'subscript', 'superscript' );
    return $toolbars;
}
add_filter( 'acf/fields/wysiwyg/toolbars' , 'customToolbars'  );

where is my mistake?

question from:https://stackoverflow.com/questions/65946607/how-to-add-custom-tinymce-button-to-acf-editor

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
621 views
Welcome To Ask or Share your Answers For Others

1 Answer

Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...