Skip to content

Commit

Permalink
Code Modernization: Use str_starts_with() in `WP_REST_Server::serve…
Browse files Browse the repository at this point in the history
…_request()`.

Follow-up to [55703], [56834].

See #59650.

git-svn-id: https://develop.svn.wordpress.org/trunk@57126 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
SergeyBiryukov committed Nov 18, 2023
1 parent f72f189 commit 1427d25
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/wp-includes/rest-api/class-wp-rest-server.php
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ public function serve_request( $path = null ) {
* Send no-cache headers if $send_no_cache_headers is true,
* OR if the HTTP_X_HTTP_METHOD_OVERRIDE is used but resulted a 4xx response code.
*/
if ( $send_no_cache_headers || ( true === $method_overridden && strpos( $code, '4' ) === 0 ) ) {
if ( $send_no_cache_headers || ( true === $method_overridden && str_starts_with( $code, '4' ) ) ) {
foreach ( wp_get_nocache_headers() as $header => $header_value ) {
if ( empty( $header_value ) ) {
$this->remove_header( $header );
Expand Down

0 comments on commit 1427d25

Please sign in to comment.