Make WordPress Core


Ignore:
Timestamp:
11/30/2025 11:24:38 AM (4 months ago)
Author:
johnbillion
Message:

Options, Meta APIs: Revert additional request validity handling that was added to the /wp/v2/settings REST API route. This change needs more work to account for URL query parameters used in place of body data.

This reverts [60357] and [60301].

See #41604

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-settings-controller.php

    r60357 r61324  
    146146        $options = $this->get_registered_options();
    147147
    148         $params = array_diff_key( $request->get_params(), $request->get_query_params() );
    149 
    150         if ( empty( $params ) || ! empty( array_diff_key( $params, $options ) ) ) {
    151             $message = empty( $params )
    152                 ? __( 'Request body cannot be empty.' )
    153                 : __( 'Invalid parameter(s) provided.' );
    154 
    155             return new WP_Error(
    156                 'rest_invalid_param',
    157                 $message,
    158                 array( 'status' => 400 )
    159             );
    160         }
     148        $params = $request->get_params();
    161149
    162150        foreach ( $options as $name => $args ) {
Note: See TracChangeset for help on using the changeset viewer.