Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
05/29/2023 05:51:12 AM (20 months ago)
Author:
imath
Message:

Make sure BP_Component::parse_query() always run

Only running it when BP Rewrites are on is not the right way to go as some plugins might have been using the WP Rewrites API for a while and might have extended this method from their component's class.

Instead of only running this method if BP Rewrites are on, we're adding a URL parser check inside each component having a directory to figure out whether it's needed to set BP URI globals.

See #4954
Fixes #8908
Closes https://github.com/buddypress/buddypress/pull/109

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/classes/class-bp-component.php

    r13471 r13492  
    578578
    579579        // Allow components to parse the main query.
    580         if ( 'rewrites' === bp_core_get_query_parser() ) {
    581             /**
    582              * Only fire this hook when pretty links are disabled.
    583              *
    584              * @todo Remove once BP Rewrites merge process is ended.
    585              */
    586             add_action( 'bp_parse_query',  array( $this, 'parse_query' ), 10 );
    587         }
     580        add_action( 'bp_parse_query',  array( $this, 'parse_query' ), 10 );
    588581
    589582        // Generate rewrite rules.
     
    12361229     */
    12371230    public function parse_query( $query ) {
    1238         if ( is_buddypress() ) {
     1231        if ( is_buddypress() && 'rewrites' === bp_core_get_query_parser() ) {
    12391232            add_filter( 'posts_pre_query', array( $this, 'pre_query' ), 10, 2 );
    12401233        }
Note: See TracChangeset for help on using the changeset viewer.