PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-a.1
Jetpack – WP Security, Backup, Speed, & Growth v16.3-a.1
16.3-a.3 16.3-a.1 16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 13.8.3 13.9.2 14.0.1 All 504 releases
← All changes | json-endpoints/class.wpcom-json-api-update-taxonomy-endpoint.php +10 -1 13.5.216.3-a.1 View file →
@@ -10,8 +10,12 @@
10 10 * Delete a category: /sites/%s/categories/slug:%s/delete
11 11 * Delete a tag: /sites/%s/tags/slug:%s/delete
12 12 */
13 13
14 +if ( ! defined( 'ABSPATH' ) ) {
15 + exit( 0 );
16 +}
17 +
14 18 new WPCOM_JSON_API_Update_Taxonomy_Endpoint(
15 19 array(
16 20 'description' => 'Create a new category.',
17 21 'group' => 'taxonomy',
@@ -184,8 +188,10 @@
184 188 );
185 189
186 190 /**
187 191 * Update site taxonomy API class.
192 + *
193 + * @phan-constructor-used-for-side-effects
188 194 */
189 195 class WPCOM_JSON_API_Update_Taxonomy_Endpoint extends WPCOM_JSON_API_Taxonomy_Endpoint {
190 196 /**
191 197 * Update site taxonomy API callback.
@@ -325,9 +331,12 @@
325 331 if ( ! empty( $input['name'] ) ) {
326 332 $update['name'] = addslashes( $input['name'] );
327 333 }
328 334
329 - $data = wp_update_term( $taxonomy->term_id, $taxonomy_type, $update );
335 + $data = wp_update_term( $taxonomy->term_id, $taxonomy_type, $update );
336 + if ( is_wp_error( $data ) ) {
337 + return $data;
338 + }
330 339 $taxonomy = get_term_by( 'id', $data['term_id'], $taxonomy_type );
331 340
332 341 $return = $this->get_taxonomy( $taxonomy->slug, $taxonomy_type, $args['context'] );
333 342 if ( ! $return || is_wp_error( $return ) ) {