mirror of
https://github.com/WordPress/WordPress.git
synced 2024-06-29 00:04:58 +02:00
REST API: Set default sanitize callback if type is set.
Props joehoyle, ChopinBach, jnylen0. Fixes #38593. Built from https://develop.svn.wordpress.org/trunk@39091 git-svn-id: http://core.svn.wordpress.org/trunk@39033 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
862724274e
commit
3fef086ede
|
@ -804,6 +804,11 @@ class WP_REST_Request implements ArrayAccess {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
foreach ( $this->params[ $type ] as $key => $value ) {
|
foreach ( $this->params[ $type ] as $key => $value ) {
|
||||||
|
// if no sanitize_callback was specified, default to rest_parse_request_arg
|
||||||
|
// if a type was specified in the args.
|
||||||
|
if ( ! isset( $attributes['args'][ $key ]['sanitize_callback'] ) && ! empty( $attributes['args'][ $key ]['type'] ) ) {
|
||||||
|
$attributes['args'][ $key ]['sanitize_callback'] = 'rest_parse_request_arg';
|
||||||
|
}
|
||||||
// Check if this param has a sanitize_callback added.
|
// Check if this param has a sanitize_callback added.
|
||||||
if ( ! isset( $attributes['args'][ $key ] ) || empty( $attributes['args'][ $key ]['sanitize_callback'] ) ) {
|
if ( ! isset( $attributes['args'][ $key ] ) || empty( $attributes['args'][ $key ]['sanitize_callback'] ) ) {
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.7-beta1-39090';
|
$wp_version = '4.7-beta1-39091';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user