Tiny MCE not adding p tag when saving theme option

I am adding tinymce edior with new wp_editor() function on theme option page. On submit the theme option sends data to option.php where it saves. But tinymce doesn’t seem to convert the line breaks into <p> tags as we see in the post and pages from the edit page. Other styles and htmls that I add from the editors are okey.

Do i have to use any filter on it before it saves?

Read More

I am showing the content with a echo.

<?php echo theme_option('homepage_content'); ?>

Related posts

Leave a Reply

1 comment

  1. If you want the contents of an option, variables, or anything for that matter to be treated like post content you’ll need to call the post content filters.

    <?php echo apply_filters( 'the_content', $your_var ); ?>
    

    Your data is then treated in the same way as post content is, inline with the code sample you’ve posted, the call should go like this..

    <?php echo apply_filters( 'the_content', theme_option('homepage_content') ); ?>
    

    Hope that helps. 🙂