How do I add paragraph tags to all of my posts after relying on wpauto?

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?

Related posts

Leave a Reply

1 comment

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