Title: Generate Loop with Custom Post type query problem
Last modified: August 22, 2016

---

# Generate Loop with Custom Post type query problem

 *  [Vokrik](https://wordpress.org/support/users/vokrik/)
 * (@vokrik)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/generate-loop-with-custom-post-type-query-problem/)
 * Hi, I am having a problem with generating loop for my custom post type.
 * I am adding a post type “coffee_break” to a custom made theme by external developer.
 * For adding the Custom Post Type I used a plugin called “WCK – Custom Fields and
   Custom Post Types Creator”… All is hunky dory until I try to create a loop in
   the UI using a loop builder in the pagebuilder. The problem is that the proper
   query should look like this (it’s generated when using old post type ‘testimonial’)
   
   SELECT wp_posts.* FROM wp_posts JOIN wp_icl_translations t ON wp_posts.ID = t.
   element_id AND t.element_type IN (‘post_testimonial’,’post_attachment’)…
 * With the coffee_break I get this
 * SELECT wp_posts.* FROM wp_posts JOIN wp_icl_translations t ON wp_posts.ID = t.
   element_id AND t.element_type IN (‘post_attachment’) …
 * The difference is that in the first case, t.element_type contains (‘post_testimonial’,’
   post_attachment’), the coffee_break only (‘post_attachment’) and therefore it
   finds nothing.
 * Do you know how can this happen? Is there a problem with initialization of a 
   custom post type?

The topic ‘Generate Loop with Custom Post type query problem’ is closed to new replies.

## Tags

 * [custom post type](https://wordpress.org/support/topic-tag/custom-post-type/)
 * [loop](https://wordpress.org/support/topic-tag/loop/)

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 0 replies
 * 1 participant
 * Last reply from: [Vokrik](https://wordpress.org/support/users/vokrik/)
 * Last activity: [11 years, 8 months ago](https://wordpress.org/support/topic/generate-loop-with-custom-post-type-query-problem/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
