我有一个包含多个wp\\U编辑器的页面。我需要做两个。我尝试了以下方法,但没有成功。我确实把它放在加载页面的函数之后,但不确定它是否应该放在其他地方。非常感谢您的帮助。
Code to load the wp_editor
$content = "";
$editorid = "statement";
$settings = array(
\'textarea_name\' => \'statement\',
\'editor_height\' => 100,
\'quicktags\' => false,
\'media_buttons\' => false,
\'teeny\' => true,
\'tinymce\'=> array(
\'theme_advanced_disable\' => \'fullscreen\',
\'width\' => 500,
)
);
wp_editor( $content, $editorid, $settings );
Code to make the editor required
add_filter( \'statement\', \'add_required_attribute_to_wp_editor\', 10, 1 );
function add_required_attribute_to_wp_editor( $editor ) {
$editor = str_replace( \'<textarea\', \'<textarea required="required"\', $editor );
return $editor;
}