wp_editor removes paragraph from custom meta box

I have created a custom meta box like so:

/*quote meta box*/
add_action('add_meta_boxes', 'quote_meta_box');
function quote_meta_box($post) {
    global $post;
    $post_id = $_GET['post'] ? $_GET['post'] : $_POST['post_ID'] ;
    $blogPage = get_option('page_for_posts');

    if($blogPage != $post_id) {
        if($post_id != '8') {
            add_meta_box('quote_id', 'Quote', 'quote_meta_box_cb', 'page', 'normal', 'high');   
        }
    }
}

function quote_meta_box_cb($post) {
    global $post;

    wp_nonce_field('quote_nonce', 'quote_meta_box_nonce');

    $values = get_post_custom($post->ID);

    $quote = get_post_meta($post->ID, 'quote_text', true);

    $settings = array(
        'textarea_rows' => 15
    );

    echo '<p><strong>Quote</strong></p>';
    wp_editor($quote, 'quote-text', $settings);
}

function quote_save($post_id) {
    if(defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return;

    if(!isset($_POST['quote_meta_box_nonce']) || !wp_verify_nonce($_POST['quote_meta_box_nonce'], 'quote_nonce')) return;
    if(!current_user_can('edit_post')) return;

    if(isset($_POST['quote-text'])) {
        update_post_meta($post_id, 'quote_text', $_POST['quote-text']);
    }
}
add_action('save_post', 'quote_save');

I am then calling this out on my template like:

Read More
<?php $quote = get_post_meta($post_id, 'quote_text', true); ?>
<?php echo $quote; ?>

I am trying to add a paragraph and a heading tag. Everytime i save the page wp_editor() strips out my p tags but keeps the h4 i use.

can someone please help as i am pulling my hair out as i have no idea why it is doing this.

Thanks

Alex

Related posts

1 comment

Comments are closed.