Make WordPress Core

Changeset 39091


Ignore:
Timestamp:
11/02/2016 06:27:29 AM (8 years ago)
Author:
rmccue
Message:

REST API: Set default sanitize callback if type is set.

Props joehoyle, ChopinBach, jnylen0.
Fixes #38593.

File:
1 edited

Legend:

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

    r39087 r39091  
    805805            }
    806806            foreach ( $this->params[ $type ] as $key => $value ) {
     807                // if no sanitize_callback was specified, default to rest_parse_request_arg
     808                // if a type was specified in the args.
     809                if ( ! isset( $attributes['args'][ $key ]['sanitize_callback'] ) && ! empty( $attributes['args'][ $key ]['type'] ) ) {
     810                    $attributes['args'][ $key ]['sanitize_callback'] = 'rest_parse_request_arg';
     811                }
    807812                // Check if this param has a sanitize_callback added.
    808813                if ( ! isset( $attributes['args'][ $key ] ) || empty( $attributes['args'][ $key ]['sanitize_callback'] ) ) {
Note: See TracChangeset for help on using the changeset viewer.