我发现我需要添加html_entity_decode()
所以我的最终代码是。。。
/**
* Add Copyright text to general settings menu
*/
$custom_general_settings = new FD_Custom_General_Settings();
class FD_Custom_General_Settings
{
function __construct()
{
add_filter(\'admin_init\', array(&$this , \'register_fields\'));
}
function register_fields()
{
register_setting(\'general\', \'footer_text\', \'esc_attr\');
add_settings_field(\'footer_text\', \'<label for="footer_text">\'.__(\'Footer Text\' , \'footer_text\' ).\'</label>\' , array(&$this, \'fields_html\') , \'general\');
}
function fields_html()
{
$value = html_entity_decode(get_option(\'footer_text\', \'\'));
wp_editor($value, \'footer_text\', array(\'textarea_rows\'=>4), false);
}
}
然后将其输出到主题中,并维护任何短代码和换行符。。。
echo nl2br(html_entity_decode(do_shortcode(get_option(\'footer_text\', \'\'))));