Javascript Wordpress:TypeError:window.tinyMCE.ExecutInstanceCommand不是函数

Javascript Wordpress:TypeError:window.tinyMCE.ExecutInstanceCommand不是函数,javascript,wordpress,Javascript,Wordpress,我无法在我的wordpress编辑器中添加任何短代码。它显示- TypeError: window.tinyMCE.execInstanceCommand is not a function window.tinyMCE.execInstanceCommand(id, 'mceInsertContent', false, shortcode) 。请帮我解决这个问题。TinyMCE API在版本4之后发生了更改 假设您拥有jQuery 1.7或更高版本 jQuery(window).on("

我无法在我的wordpress编辑器中添加任何短代码。它显示-

TypeError: window.tinyMCE.execInstanceCommand is not a function

window.tinyMCE.execInstanceCommand(id, 'mceInsertContent', false, shortcode)

。请帮我解决这个问题。

TinyMCE API在版本4之后发生了更改

假设您拥有jQuery 1.7或更高版本


jQuery(window).on("load", function(){
    // First get the loaded TinyMCE version:
    var mceVersion = parseInt(tinyMCE.majorVersion);

    // ...

    // Then later in your code where you want to insert your content:
    if(mceVersion >= 4){
        tinyMCE.execCommand("mceInsertContent", false, shortcode);
    }else{
        tinyMCE.execInstanceCommand("content", "mceInsertContent", false, shortcode);
    }
});
可能重复的