WP Query issue with WordPress 4.6
-
After updating to WordPress 4.6, any WordPress queries that include both ‘category_name’ and ‘author_name’ results in the following error:
WordPress database error: [Not unique table/alias: ‘wp_term_relationships’]
SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts LEFT JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) LEFT JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) LEFT JOIN wp_term_taxonomy ON ( wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id ) WHERE 1=1 AND ( wp_term_relationships.term_taxonomy_id IN (1) ) AND ((wp_posts.post_author = 1 OR (wp_term_taxonomy.taxonomy = ‘author’ AND wp_term_taxonomy.term_id = ‘5’))) AND wp_posts.post_type = ‘post’ AND ((wp_posts.post_status = ‘publish’)) GROUP BY wp_posts.ID HAVING MAX( IF ( wp_term_taxonomy.taxonomy = ‘author’, IF ( wp_term_taxonomy.term_id = ‘5’,2,1 ),0 ) ) <> 1 ORDER BY wp_posts.post_date DESC LIMIT 0, 1To reproduce, add this to a clean WordPress 4.6 install running CoAuthors Plus: https://gist.github.com/billerickson/c2422064a108e777dd15fa44dfd60306
First reported here: https://ww.wp.xz.cn/support/topic/any-problems-with-wp-46?replies=7
The topic ‘WP Query issue with WordPress 4.6’ is closed to new replies.