From ff5be90aad5daa894d588cb0f05a12b7c6a436dc Mon Sep 17 00:00:00 2001 From: Rachel Baker Date: Thu, 1 Dec 2016 02:45:17 +0000 Subject: [PATCH] REST API: Fix incorrect capability check on term create. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change the capability check used in `WP_REST_Terms_Controller` when creating a new term is attempted, from `manage_terms` to `edit_terms`. This matches the behavior within the WordPress admin. See #35614. Props johnbillion, rmccue, rachelbaker, helen, jorbin, SergeyBiryukov. Merges [39402] to the 4.7 branch. Fixes #38958 for 4.7. git-svn-id: https://develop.svn.wordpress.org/branches/4.7@39403 602fd350-edb4-49c9-b593-d223f7449a82 --- .../rest-api/endpoints/class-wp-rest-terms-controller.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php index f48ab0620a..d59fda46fb 100644 --- a/src/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php +++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php @@ -349,7 +349,7 @@ class WP_REST_Terms_Controller extends WP_REST_Controller { } $taxonomy_obj = get_taxonomy( $this->taxonomy ); - if ( ! current_user_can( $taxonomy_obj->cap->manage_terms ) ) { + if ( ! current_user_can( $taxonomy_obj->cap->edit_terms ) ) { return new WP_Error( 'rest_cannot_create', __( 'Sorry, you are not allowed to create new terms.' ), array( 'status' => rest_authorization_required_code() ) ); }