Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I found a way to export my posts in text form so that I can move them to a blog with static pages. The only problem is that there are no paragraph tags, so every post is a huge block of text. I had been using line breaks and relying on wpauto to add paragraph tags automatically.

Is there any way to add those tags into my posts without doing it by hand?

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

a quick and dirty way to do this is by running this ONCE:

global $post;
$posts = new WP_Query();
$posts->query(array('posts_per_page' => -1, 'post_type' => 'post'));
while ($posts->have_posts()):
  $posts->the_post();
  $post->post_content = wpautop($post->post_content); // replaces new line chars with <p>'s
  wp_update_post($post); // updates the database
endwhile;

(didn't test it)

But how are you exporting your posts in text form? Maybe you could apply the autop filter in your export routine

share|improve this answer
add comment

Your Answer

 
discard

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