I have a taxonomy with posts assigned to terms, and on the term archive page i get no found post

$rewrite = array(
    'slug'                       => 'mytax',
    'with_front'                 => true,
    'hierarchical'               => false,
$args = array(
    'labels'                     => $labels,
    'hierarchical'               => true,
    'public'                     => true,
    'show_ui'                    => true,
    'show_admin_column'          => true,
    'show_in_nav_menus'          => true,
    'show_tagcloud'              => true,
    'rewrite'                    => $rewrite,

and in my post list in admin, i get the same error when i filter by terms by clicking on the term in the post list i have no error, how i can proceed ? thanks in advanced


i try to run the wp_query request ( wp_query->request ) in MySQL and it's returned the correct posts, but the wp_query->posts is empty


i try to add a new taxonomy , add a term to this taxonomy and add a post with this taxonomy, but the taxonomy leave after update the post

  • What does the archive page code look like?
    – gdaniel
    Jul 9, 2014 at 23:21
  • the most simple loop
    – zagriyen
    Jul 10, 2014 at 16:46
  • With the debug bar i got this SELECT SQL_CALC_FOUND_ROWS xxx_3_posts.ID FROM xxx_3_posts INNER JOIN xxx_3_term_relationships ON (xxx_3_posts.ID = xxx_3_term_relationships.object_id) WHERE 1=1 AND ( xxx_3_term_relationships.term_taxonomy_id = 10 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
    – zagriyen
    Jul 10, 2014 at 17:36

2 Answers 2


your code seems to be correct.

Here is the process to debug it:

  • As your code is correct (what I can see), you need to update your htaccess. To perform it, go to the permalinks WP section and save again permalinks (keep your structure).
  • If not working, you need to flush rewrite rules on your function.php template
  • If not working, you need to check the name of your custom template
  • If not working, you need to remove your query variable with static variables (to find the if this is a template issue - wp template condition as been tested before)
  • If not working, from an empty project, add you CPT an CT to review if there is any problem with plug-in etc
  • If not working, send me a link to your staging server, I will find the issue in less than 5 min.

Hope this help

  • it's not a frontend bug
    – zagriyen
    Jul 11, 2014 at 14:18
  • All tasks describe above are purely back-end. After reading again your question, what you need to do is to chek your label variable. Only simple character will be accepted (no space, ' " ). It might be the issue
    – Romain
    Jul 11, 2014 at 14:51

I found the issue, it's due to feedwordpress, i solved it by turn off Optimize IN clauses thanks for your help

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.