Make WordPress Core

Changeset 57126


Ignore:
Timestamp:
11/18/2023 08:44:32 PM (8 months ago)
Author:
SergeyBiryukov
Message:

Code Modernization: Use str_starts_with() in WP_REST_Server::serve_request().

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

See #59650.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/class-wp-rest-server.php

    r57120 r57126  
    481481         * OR if the HTTP_X_HTTP_METHOD_OVERRIDE is used but resulted a 4xx response code.
    482482         */
    483         if ( $send_no_cache_headers || ( true === $method_overridden && strpos( $code, '4' ) === 0 ) ) {
     483        if ( $send_no_cache_headers || ( true === $method_overridden && str_starts_with( $code, '4' ) ) ) {
    484484            foreach ( wp_get_nocache_headers() as $header => $header_value ) {
    485485                if ( empty( $header_value ) ) {
Note: See TracChangeset for help on using the changeset viewer.