»  Knowledgebase  »  WordPress Administration  »  Update WordPress Post Type using SQL

Update WordPress Post Type using SQL

by | May 28, 2021 | 0 comments

If you need to switch post types in WordPress, you can do this quickly using the free plugin “Post Type Switcher” available on the WordPress respository (https://en-gb.wordpress.org/plugins/p…).

If you need to do this programmatically, it’s also simple to do using some basic SQL. In this video I explain how.

Don’t forget to backup first!

SQL

SQL Used (adapt table names and post types for your own database and requirements) To display your post types:
SELECT distinct post_type 
FROM wp_posts
To update using ID:
UPDATE wp_posts
SET post_type = 'knowledgebase'
WHERE id in (1783,1784,1785,1786, 1787,1788)
To update everything
UPDATE wp_posts
SET post_type = 'knowledgebase'
WHERE post_type = 'post'

0 Comments

Submit a Comment

Your email address will not be published.

UK WordPress Support

We are a team of UK based WordPress experts offering WordPress help & support, WordPress site management and maintenance, content management services, one to one WordPress training and consultancy.

Need to chat? Contact Us Now!

WordPress Maintenance

Let us manage your plugin and theme updates, keep your WordPress website site running smoothly and your visitors happy!

WordPress Care Plans
from just £35 / month!

One to One WordPress Training

We provide one to one WordPress training to individuals and companies all over the World!

Whether you are developing new skills for business or working on a personal project, we can support you, and your first trial session is free!

Book an initial WordPress Orientation Session

Get the WordPress Management Guide

Get the WordPress Management Guide

Sign up to our newsletter to receive our insider guide to managing WordPress in [currentyear], free to your inbox.

You have Successfully Subscribed!