我正在尝试使用插件设置api添加wp\\U编辑器,但文本没有保存。
// add the admin settings and such
add_action(\'admin_init\', \'my_plugin_admin_init\');
function my_plugin_admin_init(){
register_setting( \'my_plugin_settings\', \'my_plugin_settings\', \'my_plugin_settings_validate\');
add_settings_field(\'my_plugin_user_custom_text\', __(\'Enter your message\',\'WP-Shabbat\'), \'my_plugin_user_custom_text\', \'my_plugin\', \'my_plugin_main\');
function my_plugin_user_custom_text() {
$options = get_option(\'my_plugin_settings\');
$settings = array(\'media_buttons\' => false,\'textarea_rows\' => 5,\'textarea_name\' => \'user_cutom _text_msg\');
wp_editor( $options[\'user_custom_text\'],\'user_custom_text\', $settings );}
// validate
function my_plugin_settings_validate() {
$options = get_option(\'my_plugin_settings\');
$user_custom_text = $input[\'user_custom_text\'];
if ( empty($user_custom_text) ){
$options[\'user_custom_text\'] = $user_custom_text;
}else{
$options[\'user_custom_text\'] = __(\'Enter your own text\',\'WP-my-plugin\');// as set when the plugin activated
有什么想法吗?