I am making my theme. I am using wp_editor in front-end to submit post.

I submit through wp_editor in the specific page, and this being displayed in single.php. At single.php I am using

<?php the_content(); ?>

The problem is when I put enter-key (like br tag) in a post that is several blank row, these blank rows are disappeared. All contents are shown without blank row. so it looks not cool.

My first language is not English, so I am not sure that my expression is good to explain my intention.

I mean, I want like this (A). but the content shows like (B). There's no blank rows..

(A) My name is mike. Hi.
Hahaha. you look nice.

And what is you name?

(B) My name is mike. Hi.
Hahaha. you look nice.
And what is you name?

Can someone have any idea?

Thank you.


I think, there is a lack of wp_autop() and other formatting functions that get applied to the the_content filter. The editor does not save <p> tags at all, but later on line-breaks are converted into paragraphs by wp_autop().

I would like to say about meta content, for that like to recreate the default filters. I do this because some plugins add things by the the_content filter.

There is some filters like below:-

add_filter( 'meta_content', 'wptexturize' );
add_filter( 'meta_content', 'convert_smilies' );
add_filter( 'meta_content', 'convert_chars' );
add_filter( 'meta_content', 'wpautop' );
add_filter( 'meta_content', 'shortcode_unautop' );
add_filter( 'meta_content', 'prepend_attachment');
add_filter( 'meta_content', 'do_shortcode' );

Place the below code where you want to display your actual data.

$your_description = get_post_meta($post->ID, 'meta_name', true);
echo apply_filters( 'meta_content', $your_description );
| improve this answer | |

I remember banging my head against the wall trying to solve this one :) Check if you have properly initialized your post with the_post() in the loop.

If it doesn't help, you can apply content filter manually like this:

global $post;
echo apply_filters('the_content', $post->post_content);

FYI the_content filter contains hooks that expand shortcodes, wrap all things in paragraphs and do other formatting

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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