Changeset 62396
- Timestamp:
- 05/21/2026 06:52:59 AM (45 hours ago)
- Location:
- trunk
- Files:
-
- 2 edited
-
src/wp-includes/abilities.php (modified) (1 diff)
-
tests/phpunit/tests/abilities-api/wpRegisterCoreAbilities.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/abilities.php
r61690 r62396 112 112 $result = array(); 113 113 foreach ( $requested_fields as $field ) { 114 $result[ $field ] = get_bloginfo( $field ); 114 if ( 'language' === $field ) { 115 $result[ $field ] = str_replace( '_', '-', get_locale() ); 116 } else { 117 $result[ $field ] = get_bloginfo( $field ); 118 } 115 119 } 116 120 -
trunk/tests/phpunit/tests/abilities-api/wpRegisterCoreAbilities.php
r61363 r62396 114 114 $this->assertSame( get_bloginfo( 'name' ), $result['name'] ); 115 115 $this->assertSame( get_bloginfo( 'url' ), $result['url'] ); 116 } 117 118 /** 119 * Tests `core/get-site-info` language field returns the site locale, not the current user's locale. 120 * @ticket 64977 121 */ 122 public function test_core_get_site_info_language_uses_site_locale(): void { 123 $admin_id = self::factory()->user->create( 124 array( 125 'role' => 'administrator', 126 'locale' => 'de_DE', 127 ) 128 ); 129 wp_set_current_user( $admin_id ); 130 131 $ability = wp_get_ability( 'core/get-site-info' ); 132 $result = $ability->execute( 133 array( 134 'fields' => array( 'language' ), 135 ) 136 ); 137 138 $this->assertIsArray( $result ); 139 $this->assertArrayHasKey( 'language', $result ); 140 // Should return the site locale (en-US), not the user locale (de-DE). 141 $this->assertSame( 'en-US', $result['language'] ); 116 142 } 117 143
Note: See TracChangeset
for help on using the changeset viewer.