WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a custom post type ('Model') for a sports modelling agency, and it requires the model to enter sports they are competent at, and also rank their ability from 1 to 5. For example, given the information:

Model: Joe Soap.
Football: 4.
Archery: 2

I would store this in the custom_post_type 'model' with the fields:

Model Name: Joe Soap.
Sports: Football, Archery (taxonomy).
Rank: 4, 2.

How do I associate 4 with Football and 2 with Archery using a metabox, where different models may have different sports in their lists ?

share|improve this question
hm... I misunderstood your initial question. Store "rank" as a multidimensional array (into a option), like $rank[sports_taxonomy_term][rank_value] – onetrickpony Jan 11 '11 at 20:41
That sounds like what I need - can you be more specific, or point me to a tutorial/documentation on how to do that within a custom post? – Amanda Jan 11 '11 at 21:00
first, create your rank metabox (the form that gets the values) and post the code here... – onetrickpony Jan 11 '11 at 21:11
up vote 1 down vote accepted

Your question is focusing on the wrong thing. A metabox is just one way for a user to introduce some data. The more important question is how you should store that data in the database.

You could make 'sport' a custom post type and connect it to models using the Posts 2 Posts plugin. Then, for each connection, you can associate a 'rank' custom field:


The plugin takes care of creating a metabox and of storing the values in an efficient manner.

share|improve this answer

add_meta_box() documentation in Codex has example of metabox creation and links to related tutorials.

share|improve this answer

This tutorial on adding custom meta boxes is also really good: http://webdesignfan.com/custom-write-panels-in-wordpress/

It's all very flexible; you should be able to reuse the code you create.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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