WPCOM_JSON_API_Get_Taxonomy_Endpoint

The Jetpack by WordPress.com WPCOM JSON API Get Taxonomy Endpoint class.

Defined (1)

The class is defined in the following location(s).

/json-endpoints/class.wpcom-json-api-get-taxonomy-endpoint.php  
  1. class WPCOM_JSON_API_Get_Taxonomy_Endpoint extends WPCOM_JSON_API_Taxonomy_Endpoint { 
  2. // /sites/%s/tags/slug:%s -> $blog_id, $tag_id 
  3. // /sites/%s/categories/slug:%s -> $blog_id, $tag_id 
  4. function callback( $path = '', $blog_id = 0, $taxonomy_id = 0 ) { 
  5. $blog_id = $this->api->switch_to_blog_and_validate_user( $this->api->get_blog_id( $blog_id ) ); 
  6. if ( is_wp_error( $blog_id ) ) { 
  7. return $blog_id; 
  8.  
  9. $args = $this->query_args(); 
  10. if ( preg_match( '#/tags/#i', $path ) ) { 
  11. $taxonomy_type = "post_tag"; 
  12. } else { 
  13. $taxonomy_type = "category"; 
  14.  
  15. $return = $this->get_taxonomy( $taxonomy_id, $taxonomy_type, $args['context'] ); 
  16. if ( !$return || is_wp_error( $return ) ) { 
  17. return $return; 
  18.  
  19. /** This action is documented in json-endpoints/class.wpcom-json-api-site-settings-endpoint.php */ 
  20. do_action( 'wpcom_json_api_objects', 'taxonomies' ); 
  21.  
  22. return $return;