Last active
March 4, 2022 19:50
-
-
Save fida02/c196ccd069884bfcd8f5d0b64ee3fcca to your computer and use it in GitHub Desktop.
Change custom post type name, custom taxonomy name and runc the function once
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Migrate data from v2.0.4 to v2.1.0 | |
| * | |
| * run once | |
| */ | |
| function fida_migrate_data() { | |
| if ( get_option( 'fida_migrate_data_204' ) < 1 ) { | |
| global $wpdb; | |
| $wpdb->update( $wpdb->posts, ['post_type'=>'New_Post_Type'] , ['post_type' => 'Old_Post_Type'] ); | |
| $wpdb->update( $wpdb->term_taxonomy, ['taxonomy'=>'New_Taxonomy'] , ['taxonomy' => 'Old_Taxonomy'] ); | |
| update_option( 'fida_migrate_data_204', 1 ); | |
| } | |
| } | |
| add_action( 'init', 'fida_migrate_data' ); | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment