Changeset 14144
- Timestamp:
- 12/15/2025 02:57:47 AM (5 months ago)
- Location:
- branches/14.0
- Files:
-
- 2 edited
-
src/bp-core/classes/class-bp-component.php (modified) (1 diff)
-
tests/phpunit/testcases/routing/core.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/14.0/src/bp-core/classes/class-bp-component.php
r14060 r14144 1264 1264 public function parse_query( $query ) { 1265 1265 if ( is_buddypress() && 'rewrites' === bp_core_get_query_parser() ) { 1266 // 'is_home' should always be false when on a BP page. 1267 if ( $query->is_main_query() ) { 1268 $query->is_home = false; 1269 } 1270 1266 1271 add_filter( 'posts_pre_query', array( $this, 'pre_query' ), 10, 2 ); 1267 1272 } -
branches/14.0/tests/phpunit/testcases/routing/core.php
r13507 r14144 22 22 } 23 23 24 function test_wordpress_page() {24 public function test_wordpress_page() { 25 25 $this->set_permalink_structure( '/%postname%/' ); 26 26 $this->go_to( '/' ); 27 27 $this->assertEmpty( bp_current_component() ); 28 28 } 29 30 /** 31 * @ticket BP9300 32 */ 33 public function test_buddypress_directory_is_home_false() { 34 $this->set_permalink_structure( '/%postname%/' ); 35 36 $is_home_value = null; 37 38 // Capture the is_home value during pre_get_posts for the main query. 39 $callback = function ( $query ) use ( &$is_home_value ) { 40 if ( $query->is_main_query() ) { 41 $is_home_value = $query->is_home; 42 } 43 }; 44 45 add_action( 'pre_get_posts', $callback ); 46 47 $this->go_to( bp_get_members_directory_permalink() ); 48 49 remove_action( 'pre_get_posts', $callback ); 50 51 $this->assertFalse( $is_home_value, 'is_home should be false for a BuddyPress directory page on the main query.' ); 52 } 29 53 }
Note: See TracChangeset
for help on using the changeset viewer.