How To: Move or Convert WordPress Pages to Posts

Advertisement

WordPress is one of the leading CMS today, for personal blog or for business site with Over 25 million people have chosen, in WordPress you can create posts and pages separately, Pages are static and are not listed by date while the Posts is opposite and you can assign it to any category and sub-category as many as you want, visit WordPress support for more information on posts and pages, but sometimes we mistake creating both, we create page instead of post or vise versa and WordPress does not support yet converting this automatically within admin panel so I decided to create this tutorial to help you out this problem.

Difficulties: Intermediate

Important: It requires Cpanel login information.

Login to your Cpanel and click phpMyAdmin by default it is shown at the bottom of your CPanel page, after you click it then select the database of your site, if you don’t know the database name of your site, you can see it in the wp-config.php file, in line 19 that says


define('DB_NAME', 'YOUR_DATABASE_NAME');

Under in your database name click wp_posts table and it shows all pages and posts records of your site, if you have a bunch of records there, click on the SQL tab at the top and paste this line of code.


SELECT * FROM 'wp_posts' WHERE 'post_type'='page';

That will show only all post data/records of your site.

Now you can select which record you want to convert, by clicking one of your pages.

All you need to do is edit these two records and be careful only these two records and don’t do anything else.

From this

convert-pages-to-posts-before

To this

convert-pages-to-posts-after

Thats it and click save.

Do this at your own risk

Of course, don’t forget to backup your Database first.


UPDATE `wp_posts`
SET `post_type`=`post`
WHERE `post_type`=`page`

NOTE: Table prefix does depends on your WordPress installation.

Go to your site admin panel and click on Post and you notice that the page you edited awhile ago is there but you need to assign it to a category or sub-category because by default it is assigned as Uncategorized.

Advertisement