Changeset 60073
- Timestamp:
- 03/24/2025 11:57:08 PM (2 months ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/class-wp-rest-request.php
r59899 r60073 495 495 } 496 496 497 // Exclude rest_route if pretty permalinks are not enabled. 498 if ( ! get_option( 'permalink_structure' ) ) { 499 unset( $params['rest_route'] ); 500 } 501 497 502 return $params; 498 503 } -
trunk/tests/phpunit/tests/rest-api/rest-request.php
r59899 r60073 1127 1127 ); 1128 1128 } 1129 1130 /** 1131 * @ticket 62163 1132 */ 1133 public function test_get_params_without_pretty_permalink() { 1134 update_option( 'permalink_structure', '' ); 1135 1136 $request = new WP_REST_Request(); 1137 $request->set_param( 'rest_route', '/wp/v2/posts' ); 1138 $request->set_param( 'some_param', 'foobar' ); 1139 1140 $params = $request->get_params(); 1141 1142 $this->assertArrayNotHasKey( 'rest_route', $params ); 1143 $this->assertArrayHasKey( 'some_param', $params ); 1144 } 1145 1146 /** 1147 * @ticket 62163 1148 */ 1149 public function test_get_params_with_pretty_permalinks() { 1150 update_option( 'permalink_structure', '/%postname%/' ); 1151 1152 $request = new WP_REST_Request(); 1153 1154 $request->set_param( 'rest_route', '/wp/v2/posts' ); 1155 $request->set_param( 'some_param', 'foobar' ); 1156 1157 $params = $request->get_params(); 1158 1159 $this->assertArrayHasKey( 'rest_route', $params ); 1160 $this->assertArrayHasKey( 'some_param', $params ); 1161 } 1129 1162 }
Note: See TracChangeset
for help on using the changeset viewer.