Custom general settings (textarea field) don’t output HTML correctly
Question
I add my custom fields in genearal settings page. One of them using WordPress Editor – there i insert my HTML content. I creeated it using simple snippet:
add_action( 'admin_init', 'register_settings_wpse_57647' );
function register_settings_wpse_57647()
{
register_setting(
'general',
'opisproduktyseop',
'esc_html'
);
add_settings_section(
'site-guide',
'Publishing Guidelines',
'__return_false',
'general'
);
add_settings_field(
'opisproduktyseop',
'Enter custom message',
'print_text_editor_wpse_57647',
'general',
'site-guide'
);
}
function print_text_editor_wpse_57647()
{
$the_guides = html_entity_decode( get_option( 'opisproduktyseop' ) );
echo wp_editor(
$the_guides,
'sitepublishingguidelines',
array( 'textarea_name' => 'opisproduktyseop' )
);
}
The problem starts when i try display content from this field in my theme. HTML don’t works:
I display it using:
echo get_option( 'produktyseoopis' );
0
options, wp-editor
4 years
2020-02-13T08:39:12-05:00
2020-02-13T08:39:12-05:00 0 Answers
67 views
0
Leave an answer