Quick Tip – Convert WordPress Post to Page, Custom Post-types & Vice-versa

This is a simple tip hence this article will be short and succinct.

WordPress treats post and pages as the same – both are stored in the wp_posts table.

The table column post_type is what distinguishes them.

Posts have a post_type column value of post while Pages – page.

To convert a post with say ID 73, run the SQL query below.

[sql]
UPDATE database_name.wp_posts SET post_type = ‘page’ WHERE wp_posts.ID = 73;
[/sql]

To convert a page to a post, use the SQL query below.

[sql]
UPDATE database_name.wp_posts SET post_type = ‘post’ WHERE wp_posts.ID = 73;
[/sql]

You could also convert a page or post to a custom post type.

Say you want to convert a post/page with ID 73 to a CPT “portfolio”, use the SQL below.

[sql]
UPDATE database_name.wp_posts SET post_type = ‘portfolio’ WHERE wp_posts.ID = 73;
[/sql]

Note: Change the “database_name” to the name of your WordPress database.
If you’ve changed the table prefix to a value other than wp_, update the SQL query above accordingly.

I hope someone find this useful someday.

Don’t miss out!
Subscribe to My Newsletter
Invalid email address