Title: [Plugin: Custom Field Template] Query posts based on Template ID
Last modified: August 19, 2016

---

# [Plugin: Custom Field Template] Query posts based on Template ID

 *  [neotoxic](https://wordpress.org/support/users/neotoxic/)
 * (@neotoxic)
 * [16 years, 3 months ago](https://wordpress.org/support/topic/plugin-custom-field-template-query-posts-based-on-template-id/)
 * I am using Custom Field Templates to create posts “types”; news, review or interview
   for example. I can identify the type of post by looking at the post Template 
   ID.
 * I would like to be able to query the database to get the last 10 posts that use
   the Template ID of 2 for example.
 * As the information is stored in what I think is a serialised array within the
   custom_field_template_data meta field, I have realised that querying this data
   might not be possible. I hope I am wrong about that, and would be very thankful
   if someone could show me how I could be queried.
 * I assume its not as simple as: –
 * `$postslist = get_posts('numberposts=20&order=DESC&orderby=post_date&meta_key
   =custom_field_template_data->posts&meta_value=2');`

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [neotoxic](https://wordpress.org/support/users/neotoxic/)
 * (@neotoxic)
 * [16 years, 3 months ago](https://wordpress.org/support/topic/plugin-custom-field-template-query-posts-based-on-template-id/#post-1420764)
 * Ahh.. OK I see, so the date is stored in an array in the options table? is that
   right? That’s crazy. I guess there isn’t going to be any way I can do this then
   🙁
 * Could anyone help me out, give me some thoughts?
 *  [HeroicNate](https://wordpress.org/support/users/heroicnate/)
 * (@heroicnate)
 * [16 years, 2 months ago](https://wordpress.org/support/topic/plugin-custom-field-template-query-posts-based-on-template-id/#post-1420939)
 * wordpress 3.0 will have support for actual post types if you can wait.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘[Plugin: Custom Field Template] Query posts based on Template ID’ is 
closed to new replies.

 * 2 replies
 * 2 participants
 * Last reply from: [HeroicNate](https://wordpress.org/support/users/heroicnate/)
 * Last activity: [16 years, 2 months ago](https://wordpress.org/support/topic/plugin-custom-field-template-query-posts-based-on-template-id/#post-1420939)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
