Options – Custom common settings (textarea fields) do not output HTML correctly

I add my custom field to the general setting page. One of them is using WordPress Editor – there I insert my HTML content. I made 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 to display content from this area in my theme. HTML doesn’t work:

enter image description here

I demonstrate this using:

echo get_option( 'produktyseoopis' );

Leave a Comment