Search code examples
wordpressadvanced-custom-fieldswysiwyg

How add custom button to ACF Wysiwyg tinymce?


Im need add custom button to toolbar ACF Wysiwyg tinymce. I using this code:

tinymce.PluginManager.add( 'wdd_mce_format', function ( editor, url ) {
    editor.addButton( 'wdd_mce_format', {
        active: true,
        tooltip: 'Formating the List',
        text : 'Formating the List',
        icon : false,
        type : 'button',
        onclick : function () {
            do_stuff_here('')
        }
    } );
} );

Its good worked for standart Wordpress tinymce editor. But not work for ACF Wysiwyg tinymce.


Solution

  • Initialization of ACF Wysiwyg toolbars ignory loading of tinymce plugins
    This code solves the problem:

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

    All plugins tinymce normally work