Make WordPress Core

Opened 5 years ago

Last modified 5 years ago

#40447 new enhancement

Add cache domain to site/network query

Reported by: ocean90 Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: Networks and Sites Keywords: has-patch
Focuses: multisite Cc:


A cache domain allows to define a custom cache key to ensure unique results when one of the query filters, like sites_clauses, is used to customize the default query. This is necessary because the default cache key is only computed from the default query variables.

Previously: [18128] for terms and [38117] for comments.

Attachments (1)

40447.patch (3.6 KB) - added by ocean90 5 years ago.

Download all attachments as: .zip

Change History (4)

5 years ago

#1 @ocean90
5 years ago

On second thought, you can use the parse_site_query to register a custom query var like so:

function add_custom_query_var_to_default_query_vars( $query ) {
        if ( ! empty( $query->query_vars['custom_query_var' ] ) ) {
                $query->query_var_defaults = array_merge( $query->query_var_defaults, [ 'custom_query_var' => '' ] );
add_action( 'parse_site_query', __NAMESPACE__ . '\add_custom_query_var_to_default_query_vars' );

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

5 years ago

#3 @flixos90
5 years ago

  • Milestone changed from 4.8 to Future Release

Per Slack: https://wordpress.slack.com/archives/C03BVB47S/p1494269010909400

Let's get back to this ticket as necessary. @spacedmonkey expressed interest in working on this.

Note: See TracTickets for help on using tickets.