自定义WYSIWYG框不保存HTML格式

时间:2014-12-04 17:28:16

标签: php html wordpress tinymce

我创建了一个自定义WYSIWYG元数据箱,我使用wp_editor函数设置并通过相关设置。我的问题是,当我在框中输入文本时,尝试格式化并保存带有标题的文本,uls等它不保存格式 - 请参阅下面的屏幕截图和代码:

enter image description here

<?php 

    function theme_meta_box_services_callback($post) {
    $service_details = get_post_meta($post->ID, 'service_details', true);

    $settings_editor = array(
        'quicktags' => true,
        'tinymce' => true,
        'textarea_rows' => 8,
        'media_buttons' => true
    );

    wp_editor(esc_attr($service_details), 'service_details', $settings_editor);

    }
?>

我尝试使用“esc_html”函数而不是“esc_attr”函数,但这仍然无效。

非常感谢任何帮助。   - 吉姆。

1 个答案:

答案 0 :(得分:1)

更新

删除了esc_attr()函数,格式化了。