JB UCL
JB UCL

Reputation: 165

Custom WYSIWYG box not saving HTML formatting

I have created a custom WYSIWYG metabox which I have set up using the wp_editor function and passed the relevant settings through. My problem is that the when I input text into the box, try to format and save the text with headings, uls etc it does not save the formatting - See screenshot and code below:

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);

    }
?>

I have tried to use the "esc_html" function instead of the "esc_attr" function but this still didn't work.

Any help would be greatly appreciated. - Jim.

Upvotes: 2

Views: 1349

Answers (1)

JB UCL
JB UCL

Reputation: 165

Update

Removed the esc_attr() function, and the formatting worked.

Upvotes: 1

Related Questions