johnnyd23
johnnyd23

Reputation: 1705

Change post type name without losing custom field values

I need to change the name of one of my custom post types. These posts have several custom fields associated with them. After changing the name, I update the name of the post types in the database and all of the posts appear again in Wordpress. However, they seem to have lost their custom field information. Is this also updatable?

Upvotes: 0

Views: 1501

Answers (1)

Trishul
Trishul

Reputation: 1028

Just Run following query in your wp_posts

UPDATE `wp_posts` SET `post_type`='<new-value>' WHERE `post_type`='<old-value>';

Do remember to enter your old post type name and new post type name, changing post type name will not effect custom fields as meta fields are associated with post id only.

Cheers...

Upvotes: 1

Related Questions