Making WordPress.org

Changeset 1553


Ignore:
Timestamp:
05/07/2015 08:25:49 PM (10 years ago)
Author:
iandunn
Message:

WordCamp JSON API: Whitelist taxonomy related endpoints.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/wcorg-json-api.php

    r1552 r1553  
    2323 */
    2424function wcorg_json_whitelist_endpoints( $endpoints ) {
    25     global $wp_json_server, $wp_json_posts;
     25    global $wp_json_server, $wp_json_posts, $wp_json_taxonomies;
    2626
    2727    $whitelisted_endpoints = array(
     
    4040        '/posts/types/(?P<type>\w+)' => array(
    4141            array( array( $wp_json_posts, 'get_post_type' ),  WP_JSON_Server::READABLE ),
     42        ),
     43
     44        // Taxonomies
     45        '/posts/types/(?P<type>[\w-]+)/taxonomies' => array(
     46            array( array( $wp_json_taxonomies, 'get_taxonomies_for_type' ), WP_JSON_Server::READABLE | WP_JSON_Server::HIDDEN_ENDPOINT ),
     47        ),
     48        '/posts/types/(?P<type>[\w-]+)/taxonomies/(?P<taxonomy>[\w-]+)' => array(
     49            array( array( $wp_json_taxonomies, 'get_taxonomy' ),            WP_JSON_Server::READABLE | WP_JSON_Server::HIDDEN_ENDPOINT ),
     50        ),
     51        '/posts/types/(?P<type>[\w-]+)/taxonomies/(?P<taxonomy>[\w-]+)/terms' => array(
     52            array( array( $wp_json_taxonomies, 'get_terms' ),               WP_JSON_Server::READABLE | WP_JSON_Server::HIDDEN_ENDPOINT ),
     53        ),
     54        '/posts/types/(?P<type>[\w-]+)/taxonomies/(?P<taxonomy>[\w-]+)/terms/(?P<term>[\w-]+)' => array(
     55            array( array( $wp_json_taxonomies, 'get_term' ),                WP_JSON_Server::READABLE | WP_JSON_Server::HIDDEN_ENDPOINT ),
     56        ),
     57        '/taxonomies' => array(
     58            array( array( $wp_json_taxonomies, 'get_taxonomies' ),          WP_JSON_Server::READABLE ),
     59        ),
     60        '/taxonomies/(?P<taxonomy>[\w-]+)' => array(
     61            array( array( $wp_json_taxonomies, 'get_taxonomy_object' ),     WP_JSON_Server::READABLE ),
     62        ),
     63        '/taxonomies/(?P<taxonomy>[\w-]+)/terms' => array(
     64            array( array( $wp_json_taxonomies, 'get_taxonomy_terms' ),      WP_JSON_Server::READABLE ),
     65        ),
     66        '/taxonomies/(?P<taxonomy>[\w-]+)/terms/(?P<term>[\w-]+)' => array(
     67            array( array( $wp_json_taxonomies, 'get_taxonomy_term' ),       WP_JSON_Server::READABLE ),
    4268        ),
    4369    );
Note: See TracChangeset for help on using the changeset viewer.