Move wordpress-pages to posts

Just a quick checklist for me and a warning:

“You should think first when choosing if you create a wordpress-page or a wordpress-post!”

There are some subtle differences between pages and posts. And if you have created a page you cannot simply migrate it to a post.

I have lots of pages on my blog and want to restructure the content a bit. E.g I’d like to assign categories to these “pages” and do some further additions that some plugins only make available for posts.
And in fact – after thinking a bit – these old pages should really be posts.
If it were only a few pages, I could simply create a post, copy&paste the text over from the page, publish the post and delete the page. That’s it.

But … even with 10 pages, there must be a better way.

So let’s begin with a small tutorial.

What do you do?
You must have access to your database. If you know a plugin that can migrate pages to posts, I would be gladful to get a comment.

Ok, let’s go and do the preparations:

  1. Find all the page-ids from the pages you would like to migrate (you can simply look in the wordpress-backend and hover over each page-entries “edit”-link to see the number referred in the link.
  2. Go directly to your database and find your page in table wp_posts (resp. *_posts – depending on your database-prefix)
  3. Update the field post_type from page to post thereby not touching your post-id.
  4. To get the “behaviour” of a post you have to delete the metakey _wp_page_template from the table wp_postmeta for your post_id.
  5. To get other postmeta-information (from other plugins) you should go to the post-editor in your wordpress-backend open the (now) post, add the relevant information and save it.
  6. If you use the Widget-Logic-plugin or some other plugin which makes use of conditional tags you have to update your conditions from is_page(your-page-id) to is_single(your-page-id)
  7. Check your navigation/menues. You might need to add your created post to the menue.
  8. In pages you usually don’t have the tag to cut off the teaser-text. You should check that you insert this tag for your “new” posts.
  9. >

Here is the sql (no warranty):

UPDATE wp_posts SET post_type = 'post' WHERE ID = ;

Maybe you have used page-templates, than you should remove those entries as follows:

DELETE FROM wp_postmeta WHERE meta_key = '_wp_page_template' and post_id = ;

Did you move your pages to posts?
What pitfalls did you have?

Recent Related Posts

Hinterlasse eine Antwort

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind markiert *

Du kannst folgende HTML-Tags benutzen: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>