[wp-trac] [WordPress Trac] #42691: WP_Term_Query get_terms generates invalid sql queries

WordPress Trac noreply at wordpress.org
Sat Nov 25 21:44:52 UTC 2017


#42691: WP_Term_Query get_terms generates invalid sql queries
--------------------------+------------------------------
 Reporter:  GM_Alex       |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  General       |     Version:  4.9
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by GM_Alex):

 Hi @boonebgorges,

 you are right, this issue is the result of filtering the terms. I'm the
 author of the User Access Manager ([https://wordpress.org/plugins/user-
 access-manager/]) and I filter terms with no access. If they are hidden
 completely I return `null`, but within the plugin I also filtering the
 queries. The issue exists only in combination with an other plugin,
 Ultimate Category Excluder ([https://wordpress.org/plugins/ultimate-
 category-excluder/]). This plugin uses the `pre_get_posts` filter and sets
 `category__not_in`, while the User Access Manager returns `null` for the
 `get_term` function if the category is restricted. And that results in a
 broken query (see [https://github.com/GM-Alex/user-access-
 manager/issues/185]). But anyway since `null` is a valid return type and
 also the cache could be corrupted, we should filter the array for `null`
 values to prevent the generation of invalid queries.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/42691#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list