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:
- 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.
- Go directly to your database and find your page in table
wp_posts
(resp. *_posts – depending on your database-prefix) - Update the field
post_type
frompage
topost
thereby not touching your post-id. - To get the „behaviour“ of a post you have to delete the metakey
_wp_page_template
from the tablewp_postmeta
for yourpost_id
. - 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.
- 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)
tois_single(your-page-id)
- Check your navigation/menues. You might need to add your created post to the menue.
- In pages you usually don’t have the <!–more–> tag to cut off the teaser-text. You should check that you insert this tag for your „new“ posts.
>
Here is the sql (no warranty):
UPDATE wp_posts SET post_type = 'post' WHERE ID = <your-page-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 = <your-page-id>;
Did you move your pages to posts?
What pitfalls did you have?