Can’t access Custom Post Type posts after update

I also had the same situation (multiple custom post types). To fix this, I modified it like so:

if(!get_option('custom_type2_updated')){
global $wpdb;
$wpdb->query("UPDATE $wpdb->posts SET post_type = 'portfolio' WHERE post_type = 'Portfolio'");
update_option('custom_type2_updated','true');
}

You could make that option whatever you wanted, that just seemed to me the quickest way to change it for the second type.

Thanks to those of you who made finding this solution relatively painless.

Here is a potential varation:

<pre>UPDATE wp_posts SET post_type = REPLACE(post_type, 'old-post-type-name', 'new-post-type-name');</pre>

Revisions

There are no revisions for this post.

Tags: ,

No comments yet.

Leave a Reply