Simple you will say?

I have a first Custom post type called Country. I have a second Custom post type called Travellers. I need to make a drop down select list (multiple check) available when editing Countrywith content from Travellers. This will allow me to select travellers for each country.


thx in advance


3 Answers 3


very simeler to the question here Display list of tags as drop down menu or radio buttons in a meta box?

but instead of list of tags you need to query the post list of your travellers post type something like this:

$travelers = new WP_Query();
$travelers ->query('post_type=travelers&postprepage=-1');
while ($travelers->have_posts()) : 
   $travellersnames[] = $post->title;

and show the $travellersnames as your option for a select filed or multi select filed in your meta box

  • glad i can help
    – Bainternet
    Jan 24, 2011 at 17:12

I am trying to accomplish this same thing, but the code here is not working for me... is the syntax all correct? I have a basic working knowledge of PHP, but I can't tell what's going on here.

Perhaps some clarification?

Thanks in advance!

  • My original question: wordpress.stackexchange.com/questions/7462/…
    – user2655
    Jan 24, 2011 at 21:38
  • Hi ben, the code works by querying a custom taxonomy , in my example slide. May be paste your code and let see if we can help
    – salocin
    Jan 25, 2011 at 8:09
  • Ben, please do not use an Answer to ask a question. Either start a new question, or post a comment (either to the OP here, or to one of the answers). Once you've done that please delete your answer here. Jan 25, 2011 at 13:19
  • Sorry about that! I hesitated at first but this thread would not allow me to comment on previous answers for some reason. I see the last answer has been reformatted placing the code in the code box, so I'll mess with that and delete this answer...
    – user2655
    Jan 25, 2011 at 17:37

Following the answer I ended up with

$s_query = new WP_Query( array(
    'suppress_filters' => false,
    'post_type' => 'slide'));

    $sname = $post->post_title;
    $s_output2 ='';
    $s_output2 .= '<option value="'.$post->ID.'" >';
    $s_output2 .= $post->post_title;
    $s_output2 .= '</option>';
    echo $s_output2;

endwhile ;

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.