-
Notifications
You must be signed in to change notification settings - Fork 206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CoAuthors Plus potential incompatibility with WordPress 4.6 #374
Comments
Specifically, I think the plugin is adding a duplicate INNER JOIN. There is code in the |
Looks like this happens when you combine a taxonomy query (tag, category, etc.) and an author query. The source of the issue looks like this switch to using Specifically, the issue is that we don't find an For 4.6+, we'll likely need to add check for |
I've recently run into the same issue. Our server was overloaded and support has said that we had a large number of SQL connections that were in sleep mode b/c the connections were not closed and they said that this was the query causing it.
|
@kevinlisota Did the query ever work (i.e. return valid results) prior to 4.6? The duplicate |
It worked fine on our site prior to 4.6. The query we use in production is as I wrote above. However, there is one line of code missing at the top, which is Obviously we have a custom taxonomy in that query, but you get the idea. |
Thanks for the quick follow-up. Two more questions:
and
The first is what the query will look like under 4.6. Second is from 4.5. |
@mjangda I ran both of those queries successfully in phpMyAdmin. Both queries returned 4 post IDs with no errors. We are using the latest version of CoAuthors Plus (3.2.1 I think) |
We need to check for both INNER and LEFT JOINs to avoid adding a dupe query which leads to query errors in 4.6+. See #374
Thanks for confirming @kevinlisota. #376 should fix the "Not unique table/alias" errors. However, in testing we've found a few other issues (although, these are not specific to 4.6 as we've replicated them in 4.5 as well):
|
Is there any update on when this will be completed? One of my team's sites uses this plugin w/4.6 and we're not having any luck. |
Waiting for a fix to this |
When joining term_taxonomy, also join term_relationships with alias to prevent unintended matches in case of another taxonomy query.
There's a pending pull request (#381, needs a little love) that should solve the problem that arises when you mix |
#381 is merged, so I'm going to close this off |
We need to check for both INNER and LEFT JOINs to avoid adding a dupe query which leads to query errors in 4.6+. See #374
Upgraded to WordPress 4.6 last night, and now our install is receiving the following error when viewing our author archive pages.
We use a custom query on our author archives like this:
This throws the following database error. Did not happen prior to WP 4.6. Any thoughts on why this is happening?
WordPress database error Not unique table/alias: 'wp_term_relationships' for query 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 (2569)\n) AND ((wp_posts.post_author = 9962 OR (wp_term_taxonomy.taxonomy = 'author' AND wp_term_taxonomy.term_id = '8109'))) AND wp_posts.post_type IN ('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 = '8109',2,1 ),0 ) ) <> 1 ORDER BY wp_posts.post_date DESC LIMIT 0, 4 /*
The text was updated successfully, but these errors were encountered: