Title: Query_posts multiple dynamic checkboxes from custom post
Last modified: August 20, 2016

---

# Query_posts multiple dynamic checkboxes from custom post

 *  [mrmastermindnl](https://wordpress.org/support/users/mrmastermindnl/)
 * (@mrmastermindnl)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/query_posts-multiple-dynamic-checkboxes-from-custom-post/)
 * Hi,
 * I have created a custom field that can have multiple checkboxes for products 
   that are related to that post, that can be added dynamically using Javascript.
   At first I just saved the serialized array of checked checkboxes, but I also 
   have to be able to query based on the checkboxes. I need to be able to do a query
   that returns all posts that have a specific checkbox checked.
    So eventually 
   I need to save the checkboxes separately in a meta_key for each checkbox. So 
   far I can manage, but how would I query the checkboxes without knowing exactly
   how many different meta_keys there are for the checkboxes? I guess when saving
   the checkboxes they will be named something like: post_product_1, post_product_2,
   etc..
 * I hope the question makes sense.

Viewing 1 replies (of 1 total)

 *  Thread Starter [mrmastermindnl](https://wordpress.org/support/users/mrmastermindnl/)
 * (@mrmastermindnl)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/query_posts-multiple-dynamic-checkboxes-from-custom-post/#post-2413477)
 * Thinking about this, would it be useful to have a custom taxonomy “products” 
   which both the product-post-type and the other post-type need to use? So I can
   query on the taxonomy? Or will that give complications?

Viewing 1 replies (of 1 total)

The topic ‘Query_posts multiple dynamic checkboxes from custom post’ is closed to
new replies.

## Tags

 * [custom field](https://wordpress.org/support/topic-tag/custom-field/)
 * [query_posts](https://wordpress.org/support/topic-tag/query_posts/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 1 participant
 * Last reply from: [mrmastermindnl](https://wordpress.org/support/users/mrmastermindnl/)
 * Last activity: [14 years, 6 months ago](https://wordpress.org/support/topic/query_posts-multiple-dynamic-checkboxes-from-custom-post/#post-2413477)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
