1

我在 wordpress 中创建wp_editor如下

<?php

$content = '';
$editor_id = 'mycustomeditor';

wp_editor( $content, $editor_id );

?>

但我想以不同的方式传递id 和 name,如下所示

<?php

$content = '';
$editor_id = 'mycustomeditor';
$editor_name = 'mycustomeditorname';
wp_editor( $content, $editor_id,$editor_name );

?>

有什么办法我可以在wordpress中做到这一点

4

2 回答 2

2

请尝试这种方式。这对我来说很好。

<?php
$content = '';
$editor_id = 'mycustomeditor';
$settings = array( 'textarea_name' => 'mycustomeditorname' );
wp_editor( $content, $editor_id, $settings );
?>

在此处查找其他 wp_editor 设置,例如添加类名、css 等。 https://codex.wordpress.org/Function_Reference/wp_editor

于 2018-05-25T05:21:33.827 回答
1
<?php
 $content = '';
 $editor_id = 'mycustomeditor';
 wp_editor( $content, $editor_id, array( 'textarea_name' => 'mycustomeditorname' ) );
?>
于 2018-05-25T06:04:22.197 回答