Make WordPress Core

Changeset 39403


Ignore:
Timestamp:
12/01/2016 02:45:17 AM (10 years ago)
Author:
rachelbaker
Message:

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.

Location:
branches/4.7
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.7

  • branches/4.7/src/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php

    r39348 r39403  
    350350
    351351                $taxonomy_obj = get_taxonomy( $this->taxonomy );
    352                 if ( ! current_user_can( $taxonomy_obj->cap->manage_terms ) ) {
     352                if ( ! current_user_can( $taxonomy_obj->cap->edit_terms ) ) {
    353353                        return new WP_Error( 'rest_cannot_create', __( 'Sorry, you are not allowed to create new terms.' ), array( 'status' => rest_authorization_required_code() ) );
    354354                }
Note: See TracChangeset for help on using the changeset viewer.