Advertisement
BakerMan

Forcibly regenerate venue long/lat data for all venues

Nov 13th, 2013
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.84 KB | None | 0 0
  1. add_action( 'init', 'force_rebuild_of_coords', 20 );
  2.  
  3. function force_rebuild_of_coords() {
  4.     $venues = new WP_Query( array(
  5.         'post_type'      => TribeEvents::VENUE_POST_TYPE,
  6.         'post_status'    => 'publish',
  7.         'posts_per_page' => -1
  8.     ) );
  9.  
  10.     foreach ( $venues->posts as $venue ) {
  11.         $data = array(
  12.             'Address' => get_post_meta( $venue->ID, '_VenueAddress', true ),
  13.             'City' => get_post_meta( $venue->ID, '_VenueCity', true ),
  14.             'Province' => get_post_meta( $venue->ID, '_VenueProvince', true ),
  15.             'State' => get_post_meta( $venue->ID, '_VenueState', true ),
  16.             'Zip' => get_post_meta( $venue->ID, '_VenueZip', true ),
  17.             'Country' => get_post_meta( $venue->ID, '_VenueCountry', true )
  18.         );
  19.  
  20.         update_post_meta( $venue->ID, '_VenueGeoAddress', uniqid() );
  21.         TribeEventsGeoLoc::instance()->save_venue_geodata( $venue->ID, $data );
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement