0

Hello I have tried a lot now and I did not find a solution yet: When a page is loaded and I do a custom Query in the PHP code like this, it works and has a lot of results:

$q = new WP_Query(array('post_type'=>'video'));

When I am on a "custom taxonomy archive page" and have exactly the same code, the posts inside of the WP_Query object are always empty:

$q = new WP_Query(array('post_type'=>'video'));

I have compared the request strings:

On page (this is how it should be!):

string(243) "SELECT SQL_CALC_FOUND_ROWS  wp_ngn_posts.ID FROM wp_ngn_posts  WHERE 1=1  AND wp_ngn_posts.post_type = 'video' AND (wp_ngn_posts.post_status = 'publish' OR wp_ngn_posts.post_status = 'private')  ORDER BY wp_ngn_posts.post_date DESC LIMIT 0, 10"

On taxonomy archive page:

string(293) "SELECT SQL_CALC_FOUND_ROWS  wp_ngn_posts.ID FROM wp_ngn_posts  WHERE 1=1  AND wp_ngn_posts.post_type = 'video' AND (wp_ngn_posts.post_status = 'publish' OR wp_ngn_posts.post_status = 'private') AND wp_ngn_posts.post_content LIKE '%%'  ORDER BY wp_ngn_posts.post_date DESC LIMIT 0, 10"

Why are new WP_Query objects built differntly on the different pages [where does this "LIKE '%%' come from"? Does anybody know why this happens and what I can do to fix this?

@Edit: The post type only supports title/custom field and yes - it has query_var set to true.

@Edit 2: May this problem be caused by the qTranslate Plugin?

@Edit 3: ... LIKE '%%' should not make a difference anyway although post content for this posts is always empty?

  • Does disabling qtranslate fix the issue? – Tom J Nowell Mar 5 '14 at 21:47
  • Unfortunatly its not so easy to try this as it is a complex multisite installation and a lot of qTranslate functions are used inside of the content :-( Maybe an idea if it is possible to overwrite "wp_ngn_posts.post_content LIKE '%%'" or does anybody know where this may come from? – Blackbam Mar 5 '14 at 21:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.