REST API: Fix incorrect capability check on term create.
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. Built from https://develop.svn.wordpress.org/branches/4.7@39403 git-svn-id: http://core.svn.wordpress.org/branches/4.7@39343 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
cb6bdc2d4c
commit
1d9a15ad4a
|
@ -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() ) );
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.7-RC1-39401';
|
||||
$wp_version = '4.7-RC1-39403';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue