Reply To: Custom Fields and Mashup

Home Forums MapPress Support Custom Fields and Mashup Reply To: Custom Fields and Mashup

#12149
Chris
Keymaster

Hi,

Do you mean you have existing address values in your posts?  If so, setting an address field in the MapPress configuration doesn’t retroactively create maps for the existing posts.

You can update the posts by viewing the list of posts in the WordPress admin and then using ‘bulk actions’ -> ‘edit’ and clicking the ‘update’ button.  You can use the screen settings to view (and update) hundreds of posts at once that way.

If you want to use PHP you can loop through your existing posts and trigger either the ‘save_post’ action or ‘mappress_update_meta’ action.  You can try the code below but be careful – if you add this to your functions.php, for example, it’ll run on every view of your blog so add it, create your maps and then remove it with FTP – and make a backup first:

  $wpq = new WP_Query('post_type=post&posts_per_page=-1&fields=ids');
  foreach($wpq->posts as $postid)
  	do_action('mappress_update_meta', $postid);