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 ?

  • hm... I misunderstood your initial question. Store "rank" as a multidimensional array (into a option), like $rank[sports_taxonomy_term][rank_value] Commented Jan 11, 2011 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? Commented Jan 11, 2011 at 21:00
  • first, create your rank metabox (the form that gets the values) and post the code here... Commented Jan 11, 2011 at 21:11

3 Answers 3


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.


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


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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