WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/31/2016 05:44:56 AM (3 years ago)
Author:
pento
Message:

REST API: Allow parameters defined as array to be sent as CSVs.

This allows parameters that are often handled as CSVs to be properly parsed.

Fixes #38586.

File:
1 edited

Legend:

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

    r39046 r39048  
    997997    if ( 'array' === $args['type'] ) {
    998998        if ( ! is_array( $value ) ) {
    999             return new WP_Error( 'rest_invalid_param', sprintf( /* translators: 1: parameter, 2: type name */ __( '%1$s is not of type %2$s.' ), $param, 'array' ) );
     999            $value = preg_split( '/[\s,]+/', $value );
    10001000        }
    10011001        foreach ( $value as $index => $v ) {
Note: See TracChangeset for help on using the changeset viewer.