Created
May 16, 2012 18:50
-
-
Save micahwave/2712965 to your computer and use it in GitHub Desktop.
package migrate
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
| function migrate_old_package( $post_id ) { | |
| global $wpdb; | |
| // fix all the slides | |
| $slides = $wpdb->get_results( $wpdb->prepare(" | |
| SELECT * FROM $wpdb->posts AS s WHERE s.post_type = 'time_slide' AND s.post_parent = $post_id | |
| ")); | |
| foreach( $slides as $slide ) { | |
| $hub_id = get_post_meta( $slide->ID, 'time_hub_id', true ); | |
| $updated = wp_update_post( array( | |
| 'ID' => $slide->ID, | |
| 'post_parent' => $hub_id | |
| )); | |
| if( $updated ) delete_post_meta( $slide->ID, 'time_hub_id' ); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment