I strongly recommend you unserialize your data and modify your save routine. Something similar to this should convert your data to the new format:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | $args = array( 'post_type' => 'my-post-type', 'meta_key' => '_coordinates', 'posts_per_page' => -1 ); $query = new WP_Query( $args ); if($query->have_posts()){ while($query->have_posts()){ $query->the_post(); $c = get_post_meta($post->id,'_coordinates',true); add_post_meta($post->ID,'_longitude',$c['longitude']); add_post_meta($post->ID,'_latitude',$c['latitude']); delete_post_meta($post->ID,'_coordinates',$c); } } |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.