enter image description here I want to ask that is there a way display all my custom taxonomies in a drop down menu with checkboxes so when the user check any taxonomy it will be slected and when the user click the submit button .the new post will be created with selected custom taxonomy. i know how to insert it in new post but i WANT TO KNOW ABOUT THE DROPDOWN WITH CHECKBOXES IN THE RED BOX

1 Answer 1


To list the options for a custom taxonomy you need to query the taxonomy terms. To do that you use get_terms() http://codex.wordpress.org/Function_Reference/get_terms

// We are assuming color is the name of the taxonomy
$colors = get_terms( 'color', array(
    'orderby'    => 'name',
    'hide_empty' => 0

// Now loop through the colors and spit out the checkbox
// with the name of the color as well as the value of the term_id

foreach($colors as $color){ 

On the server side for handling the submission (once you get the form correct) you can use wp_set_post_terms() http://codex.wordpress.org/Function_Reference/wp_set_post_terms

  • but how can i use wp_set_post_terms()
    – FAWAZ
    Nov 29, 2012 at 11:37
  • 1
    wp_insert_post returns the post_id which you pass in to wp_set_terms. You also need to pass in the taxonomy name (i.e. color) as well as the term_id's
    – Rezen
    Nov 29, 2012 at 22:41

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.