You appear to be a bot. Output may be restricted
Description
Usage
WPCOM_JSON_API_Update_Term_Endpoint::callback( $path, $blog_id, $taxonomy, $slug );
Parameters
- $path
- ( mixed ) optional –
- $blog_id
- ( mixed ) optional –
- $taxonomy
- ( mixed ) optional default: category –
- $slug
- ( mixed ) optional –
Returns
void
Source
File name: jetpack/json-endpoints/class.wpcom-json-api-update-term-endpoint.php
Lines:
1 to 34 of 34
function callback( $path = '', $blog_id = 0, $taxonomy = 'category', $slug = 0 ) { $slug = urldecode( $slug ); $blog_id = $this->api->switch_to_blog_and_validate_user( $this->api->get_blog_id( $blog_id ) ); if ( is_wp_error( $blog_id ) ) { return $blog_id; } if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) { $this->load_theme_functions(); } $user = wp_get_current_user(); if ( ! $user || is_wp_error( $user ) || ! $user->ID ) { return new WP_Error( 'authorization_required', 'An active access token must be used to manage taxonomies.', 403 ); } $taxonomy_meta = get_taxonomy( $taxonomy ); if ( false === $taxonomy_meta || ( ! $taxonomy_meta->public && ! current_user_can( $taxonomy_meta->cap->manage_terms ) && ! current_user_can( $taxonomy_meta->cap->edit_terms ) && ! current_user_can( $taxonomy_meta->cap->delete_terms ) ) ) { return new WP_Error( 'invalid_taxonomy', 'The taxonomy does not exist', 400 ); } if ( $this->api->ends_with( $path, '/delete' ) ) { return $this->delete_term( $path, $blog_id, $slug, $taxonomy ); } else if ( $this->api->ends_with( $path, '/new' ) ) { return $this->new_term( $path, $blog_id, $taxonomy ); } return $this->update_term( $path, $blog_id, $slug, $taxonomy ); }