Is there anyway I could convert all the posts e have right now on our WordPress install into products using some MySQL query or something like that?
5 comments
Comments are closed.
Is there anyway I could convert all the posts e have right now on our WordPress install into products using some MySQL query or something like that?
Comments are closed.
You could install the Post Type Switcher plugin
Or Run SQL query on your database to change the post to product post type
Backup your DB 1st.
You can update the
post_type
inmysql
tablewp_posts
update thepost_type
toproduct
sample query
UPDATE wp_posts SET post_type = 'product' WHERE post_type = 'post';
Please use
$wpdb
to interact with the Database.Keep in mind that this query will change the
post_type
of everypost
toproduct
. Having a backup of your DB before doing this is recommended. It would be even better if you use a (local) test installation and refine your update process there.More info about updating rows in the DB.
Additionally (optional): SQL query for converting the categories to product_cat
I used https://wpsheeteditor.com/. the other solutions were great if you wanted to do all pages, I’d have done the SQL query, but there were about 30 pages that needed doing and 40 that didn’t. Even if a few just needed to be changed back I’d have done that but this sheet editor plugin was a huge help.