Make WordPress Core


Ignore:
Timestamp:
05/10/2022 04:07:10 PM (3 years ago)
Author:
SergeyBiryukov
Message:

Query: Restore late compact() call for the posts_clauses_request filter.

This addresses a backward compatibility break where posts_join_request and other filters were applied, but their results were subsequently discarded and earlier values were used instead.

Follow-up to [52974], [53175].

Props 5um17, johnbillion, peterwilsoncc, hellofromTonya, SergeyBiryukov.
Merges [53370] and [53375] to the 6.0 branch.
Fixes #55699.

Location:
branches/6.0
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/6.0

  • branches/6.0/src/wp-includes/class-wp-query.php

    r53277 r53379  
    27552755        }
    27562756
    2757         $clauses = array( 'where', 'groupby', 'join', 'orderby', 'distinct', 'fields', 'limits' );
     2757        $pieces = array( 'where', 'groupby', 'join', 'orderby', 'distinct', 'fields', 'limits' );
    27582758
    27592759        /*
     
    28572857             * @param WP_Query $query   The WP_Query instance (passed by reference).
    28582858             */
    2859             $clauses = (array) apply_filters_ref_array( 'posts_clauses', array( compact( $clauses ), &$this ) );
     2859            $clauses = (array) apply_filters_ref_array( 'posts_clauses', array( compact( $pieces ), &$this ) );
    28602860
    28612861            $where    = isset( $clauses['where'] ) ? $clauses['where'] : '';
     
    29912991             * @param WP_Query $query  The WP_Query instance (passed by reference).
    29922992             */
    2993             $clauses = (array) apply_filters_ref_array( 'posts_clauses_request', array( $clauses, &$this ) );
     2993            $clauses = (array) apply_filters_ref_array( 'posts_clauses_request', array( compact( $pieces ), &$this ) );
    29942994
    29952995            $where    = isset( $clauses['where'] ) ? $clauses['where'] : '';
Note: See TracChangeset for help on using the changeset viewer.