如何使用Jquery加载wp_editor?

sha*_*ank 9 jquery wordpress-plugin wp-editor

我想在我的自定义插件中使用jquery动态添加WordPress编辑器,如下所示:

 <?php

  $content = '';

  $editor_id = 'mycustomeditor';      

?>

 $('#container').append('<?php wp_editor( $content, $editor_id );?>');
Run Code Online (Sandbox Code Playgroud)

我收到错误:

参数列表后面的SyntaxError:missing)

...-active"><link rel='stylesheet' id='editor-buttons-css'  href='http://localhost 
Run Code Online (Sandbox Code Playgroud)

我也尝试过波纹管代码(这里我用单引号代替双引号):

  <?php

     $content = '';

     $editor_id = 'mycustomeditor';      

  ?>

  $('#container').append("<?php wp_editor( $content, $editor_id );?>");
Run Code Online (Sandbox Code Playgroud)

我收到错误:

 SyntaxError: missing ) after argument list   


$('#container').append("<div id="wp-mycustomeditor-wrap" class="wp-core-ui wp-ed...
Run Code Online (Sandbox Code Playgroud)

如果您有任何解决方案,请告诉我.

提前致谢

Vel*_*Vel 3

我知道迟到的答案。但这会帮助其他人。试试这个 jQuery 插件。

https://github.com/anteprimorac/js-wp-editor

你可以使用像下面这样简单的

    jQuery(document).ready(function (){

        jQuery('#container').wp_editor();

    });
Run Code Online (Sandbox Code Playgroud)