WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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:

<?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.



share|improve this question
up vote 1 down vote accepted

Did you tried echo wpautop($quote);? It's made to work with TynMCE Visual editor.

BTW, I recommend you to use the awesome class https://github.com/jaredatch/Custom-Metaboxes-and-Fields-for-WordPress

share|improve this answer
Hey Thankyou for such a quick response. That seemed to fix the issue. – asaunders Aug 6 '13 at 23:03

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.