I have been through many posts on this subject and just can't seem to wrap my head around what I need to do.

I have a form where users can submit a post to a custom post type from the from end. I want to incorporate a dropdown menu where the users can select from a custom taxonomy that I have created. I need to save the value selected when the form is submitted.

The Form:

 <fieldset class="jobcategorydropdown">
        <label for="jobcatdd"> Job Category </label>
        <?php wp_dropdown_categories( 'taxonomy=jobcats&hide_empty=0&name=ddjobcats' ); ?> 

Register Taxonomy:

register_taxonomy('jobcats', 'job_listing', array(
'hierarchical' => true,
'labels' => $labels,
'show_ui' => true,
'show_admin_column' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'topic' ),


Make new post:

function make_job_post() {

$type = 'job_listing';

$jobcatvalue = $_POST['jobcats'];

$post_information = array(
'post_title' => wp_strip_all_tags( $_POST['postTitle'] ),
'post_content' => $_POST['postContent'],
'post_type' => $type,
'post_status' => 'publish',
'tax_input' => array($jobcatvalue)

$pid = wp_insert_post($post_information);

wp_set_object_terms($pid, $jobcatvalue,'jobcats');


Am I missing something? Any help would be greatly appreciated!

  • What is $jobcatvalue? ID? Slug? Jul 28, 2015 at 17:13
  • I want it to be the value of the selection from the dropdown I guess Jul 28, 2015 at 18:00

1 Answer 1


If you save $jobcatsvalue make sure if it's an array of integers when saving.

    // Format the taxonomies
        foreach($_POST['jobcats'] as $j){
            $jobcatvalue[] = intval($j);
    } else {
        $jobcatvalue = array(intval($_POST['jobcats']));

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.