V
V
valentin_dev2020-11-16 15:31:38
WYSIWYG
valentin_dev, 2020-11-16 15:31:38

How to create custom button for ACF Wysiwyg tinymce?

You need to create your own button and add it to the toolbar.
Code like this works well for a regular WP editor:

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('')
        }
    } );
} );


For the ACF editor, it runs, but the button doesn't appear.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
valentin_dev, 2020-11-16
@valentin_dev

ACF Wysiwyg toolbars initialization interrupts loading of tinymce plugins
Solution :

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

After that, all tinymce plugins work normally.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question