[wp-trac] [WordPress Trac] #52956: WP_REST_Request->get_params() doesn't correctly handle boolean false
WordPress Trac
noreply at wordpress.org
Wed Mar 31 22:39:40 UTC 2021
#52956: WP_REST_Request->get_params() doesn't correctly handle boolean false
--------------------------+---------------------
Reporter: ivankk | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone:
Component: REST API | Version: 4.7
Severity: normal | Resolution:
Keywords: close | Focuses:
--------------------------+---------------------
Changes (by TimothyBlynJacobs):
* keywords: => close
* version: => 4.7
* component: General => REST API
* milestone: Awaiting Review =>
Comment:
Hi @ivankk,
Welcome back to trac and thanks for the ticket!
There is no way to encode a boolean value in a URL. Instead, you need to
define the expected type of your request argument using JSON Schema in
your route's `args` definition: https://developer.wordpress.org/rest-api
/extending-the-rest-api/schema/ `rest_sanitize_boolean` will then convert
a `'false'` string to a boolean `false` value.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/52956#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list