Make WordPress Core

Changes between Initial Version and Version 2 of Ticket #64926


Ignore:
Timestamp:
03/24/2026 01:30:34 PM (3 months ago)
Author:
westonruter
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #64926 – Description

    initial v2  
    2323Until a core fix lands, the following filter coerces JSON-string GET params before validation runs:
    2424
     25{{{#!php
     26<?php
    2527add_filter( 'rest_request_before_callbacks', function( $response, $handler, $request ) {
    2628    if ( 'GET' !== $request->get_method() ) {
     
    4143    return $response;
    4244}, 10, 3 );
     45}}}
    4346
    4447The proper fix belongs in `rest_validate_value_from_schema()` in `wp-includes/rest-api.php`, mirroring the json_decode coercion already present in `rest_sanitize_value_from_schema()`.