Home Forums General Issues How to initialize TinyMCE with Javascript?


How to initialize TinyMCE with Javascript?

  • I have a repeater with a acf-field-wysiwyg with “Delay initialization” activated.
    I would like to initialize TinyMCE with JS, not by clicking on the editor itself. I tried everything but I do not manage to achieve it.

    I even asked ChatGPT, who suggested the following, but no success :

    $('.acf-field-wysiwyg').each(function() {
    var field = $(this),
    editor = field.find('.acf-editor-wrap');

    // Check if the editor exists and if it has not been initialized already
    if (editor.length && !editor.hasClass('tmce-active')) {
    // Trigger the ACF action to initialize TinyMCE
    field.trigger('acf/setup_fields', [editor]);

    field.find(‘.acf-editor-wrap’); doesn’t seem correct but i tried a lot of different targets and still no success.

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.