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