Front-end checkbox submit to custom taxonomy

I’ve created a custom taxonomy in WordPress 3.1 called Gender with BOY and GIRL as categories.

function build_taxonomies() {  
register_taxonomy( 'gender', 'post', array( 'hierarchical' => true, 'label' =>  'Gender', 'query_var' => true, 'rewrite' => true ) );

I’m trying to create a front-end form that users can submit data but can’t figure out how to create a checkbox that will populate the BOY and GIRL fields under Gender. Something like this…

Read More
Gender: <input type="checkbox" name="gender" id="boy" />Boy
<input type="checkbox" name="gender" id="girl" />Girl <br />

Any ideas for a noob like me? Thanks!

Related posts

Leave a Reply

1 comment

  1. You use checkboxes, so that means that user can check both (girl, boy)?
    If this is true, then you should, in form, send names for boy and girl. You should change names in your checkbox inputs, first one will be e.g. boy and second girl. In your php code where you collect data from this form you check which one is checked and then filter your query with these params.