Make WordPress Core

Changeset 40376

Timestamp:
04/05/2017 08:24:27 PM (7 years ago)
Author:
jnylen0
Message:

REST API: Allow fetching multiple terms at once via the slug parameter.

This matches a similar change previously made for posts (#38579) and an upcoming change for users (#40213).

Props wonderboymusic, MatheusGimenez, curdin.
Fixes #40027.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php

    r39954 r40376  
    979979        $query_params['slug'] = array(
    980980            'description'       => __( 'Limit result set to terms with a specific slug.' ),
    981             'type'              => 'string',
     981            'type'              => 'array',
     982            'items'             => array(
     983                'type'          => 'string'
     984            ),
    982985        );
    983986
  • trunk/tests/phpunit/tests/rest-api/rest-tags-controller.php

    r39913 r40376  
    377377        $this->assertEquals( 1, count( $data ) );
    378378        $this->assertEquals( 'Apple', $data[0]['name'] );
     379
     380
     381
     382
     383
     384
     385
     386
     387
     388
     389
     390
     391
     392
     393
     394
     395
     396
     397
     398
     399
     400
     401
     402
     403
     404
     405
     406
     407
     408
     409
     410
     411
     412
    379413    }
    380414
  • trunk/tests/qunit/fixtures/wp-api-generated.js

    r40238 r40376  
    19911991                            "required": false,
    19921992                            "description": "Limit result set to terms with a specific slug.",
    1993                             "type": "string"
     1993                            "type": "array",
     1994                            "items": {
     1995                                "type": "string"
     1996                            }
    19941997                        }
    19951998                    }
     
    22262229                            "required": false,
    22272230                            "description": "Limit result set to terms with a specific slug.",
    2228                             "type": "string"
     2231                            "type": "array",
     2232                            "items": {
     2233                                "type": "string"
     2234                            }
    22292235                        }
    22302236                    }
Note: See TracChangeset for help on using the changeset viewer.