Make WordPress Core

Opened 8 years ago

Last modified 3 days ago

#46184 new enhancement

Add WP_Tax_Query support to WP_Site_Query

Reported by: desrosj Owned by:
Priority: normal Milestone: Future Release
Component: Networks and Sites Version:
Severity: normal Keywords: has-patch has-unit-tests
Cc: Focuses: multisite, performance

Description

Because sites are just another object type in WordPress, taxonomies can already be added to the site object type. Even though there are no user interfaces in Core for taxonomies when assigned to object types other than post (for example, see users #31383), it would be nice to add WP_Tax_Query support to WP_Site_Query.

One thing to be aware of though is that there are issues in Core when a taxonomy is assigned to multiple object types. I don't think this should be added until that is addressed. #45107 has a more detailed breakdown of that.

Change History (7)

#1 @johnjamesjacoby
8 years ago

This brings back memories (and nightmares) of the global taxonomy tables.

Interesting idea though. 👍

#2 @pbiron
8 years ago

I don't think this should be added until that is addressed. #45107 has a more detailed breakdown of that.

Another thing that should be addressed is that wp_uninitialize_site() should remove all term relationships for the site.

I'm currently developing a multisite (w/ 2000-3000 sites) that is heavily using blogmeta and site taxonomies (go-live certainly after 5.1, and maybe even 5.2). blogmeta has significantly simplified the code, having more seamless core support for taxonomies on sites would simplify it even more!

This ticket was mentioned in ​Slack in #core-multisite by pbiron. ​View the logs.


8 years ago

This ticket was mentioned in ​Slack in #core-multisite by desrosj. ​View the logs.


8 years ago

#5 @swissspidy
20 months ago

  • Keywords needs-patch added
  • Milestone Awaiting Review → Future Release

This ticket was mentioned in ​PR #11458 on ​WordPress/wordpress-develop by ​@sukhendu2002.


7 months ago
#6

  • Keywords has-patch has-unit-tests added; needs-patch removed

Trac ticket: https://core.trac.wordpress.org/ticket/46184

## Use of AI Tools

#7 @sukhendu2002
3 days ago

I've opened ​PR #11458 to add WP_Tax_Query support to WP_Site_Query through a new tax_query argument.

The PR integrates the taxonomy query clauses into the site query, handles duplicate site results and counts, and adds unit tests covering term lookups, taxonomy operators, AND/OR relations, and count queries. It also introduces a parse_site_tax_query action.

The concerns raised earlier regarding taxonomies shared across object types (#45107) and term relationship cleanup in wp_uninitialize_site() remain unresolved by this PR.

Feedback and testing would be appreciated, particularly around those concerns, taxonomy table context, and query cache invalidation.

Note: See TracTickets for help on using tickets.