thenewinquiry / tni-core-functionality

Contains the site's core functionality.
GNU General Public License v2.0
2 stars 0 forks source link

Turn two blogs into features #20

Open rachelrosenfelt opened 7 years ago

rachelrosenfelt commented 7 years ago

Hey Pea! Two of our bloggers are ending their operations. The Beheld authored by Autumn Whitefield-Madrano and Austerity Kitchen authored by Christine Baumgarthuber. I don't want to lose the posts or let their blogs sit dormant, so I wondered if we could re-classify those blog posts as features and them remove them from the blogs page? Let me know if that's doable.

misfist commented 7 years ago

Yes, it requires writing a SQL query. We'll need to:

find in wp_posts where post_type = 'blogs' and in wp_term_relationships where term_id = 43 or 44 update in wp_posts to post_type = 'post' and wp_term_relationships to term_id = 3047

misfist commented 7 years ago

I added a utility function that can be used to change post types.

tni_switch_post_type( $old_post_type, $old_term = null, $old_taxonomy = null, $new_post_type, $new_term = null, $new_taxonomy = null )

Using WP-CLI, it can be executed from the command-line on the server.

wp eval 'tni_switch_post_type( "blogs", 1464, "blog-types", "post", 3049, "category" );'

I implemented on the staging server.