Let's say for (a classic) example that I want to create an event custom post type, which will have assigned some specific fields/properties. One of them: location venue.

Location venue, which I'm thinking should be a tag in a custom taxonomy, would have, besides the title, also an url and a pair of coordinates, for example.

So, questions are:

  1. Would this be a sensible approach?
  2. How would I go implementing it?

4 Answers 4


This sounds like a good idea as it would let you query by location etc. I don't know what you plan to use the co-ordinates for, but it makes no sense to have them attached to an event (unless that event is a one-off in the middle of a field, but I guess that would be an edge case?).

As for implementation, this is a very useful plugin:


It allows you to add/get/update/delete term meta just as though it were post meta

So you could do something like this (just to give the idea, may not work 100%) :

  add_action( 'locations_edit_form_fields', 'edit_locations');
  function edit_locations($location)
    $url = get_term_meta($location->term_id, 'url', true); 
   <tr class="form-field">
      <th scope="row" valign="top"><label for="url">url</label></th>
        <input type="text" name="url" id="url" 
            value="<?php echo $url; ?>"/>
        <p class="description">Add url here.</p>

to set the information, and then use $_POST to update the meta thusly:

 add_action( 'edited_locations', 'update_location', 10, 2);
 function update_location($location_term_id)
   if (!$location_term_id) 

   if (isset($_POST['url'])) {
      //you may wish to sanitize this value (not sure if it has been already?)
      update_term_meta($location_term_id, 'url', $_POST['url']);

Further reading: http://en.bainternet.info/2011/custom-taxonomies-extra-fields

  • The coordinates wouldn't be attached to the event, they would be attached to the venue - which is assigned to the event, the venue itself would have different properties - like website and coordinates, a description etc
    – pax
    Nov 24, 2011 at 21:27
  • I think we agree, in that case. sorry if that's not clear from the above.
    – djb
    Nov 24, 2011 at 22:41

As others have already said, no, terms can not have additional properties attached to them. A term in a taxonomy is just a label for a group of items.

So, I would instead make venue a second custom post type and then connect it to the event post type using Posts 2 Posts: http://wordpress.org/extend/plugins/posts-to-posts/

  • Problem is? (how) can you then search for venues? - display all events that take place in a certain venue, like you could do with a taxonomy term (tags/categories)?
    – pax
    Nov 30, 2011 at 0:01
  • 1
    That's what P2P is all about. The only thing it doesn't have out of the box yet is rewrite rules.
    – scribu
    Nov 30, 2011 at 11:57
  • So the URLs would look like this: http://example.com/?connected_type=events-to-venues&connected_items=123 where 123 is the id of a venue. But you can add your own rewrite rules to make them prettier, say http://example.com/venue/some-venue-slug/events/
    – scribu
    Nov 30, 2011 at 12:03

The coordinates could be added using metaboxes. Check out the example here http://codex.wordpress.org/Function_Reference/add_meta_box#Example


What you're wanting is term meta data, e.g. two events are tagged at "The Big place", and "The Big Place" has coordinates etc attached to it, that are pulled in by the two events.

Unfortunately WordPress does not have a facility for term meta. You can add it via plugins, alternatively, you could have a post type location-meta, set up to not be public and not show in public listings, that you can attach the meta to, then assing it to relevant term tag.

Or you could make your taxonomy heirarchical, and add child terms with names such as 'coordinates-X-Y-Z' etc and filter them out when viewing the taxonomy terms.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.