Make WordPress Core


Ignore:
Timestamp:
09/30/2016 10:39:32 PM (8 years ago)
Author:
johnbillion
Message:

Taxonomy: Introduce more fine grained capabilities for managing taxonomy terms.

This introduces the singular edit_term, delete_term, and assign_term meta capabilities for terms, and switches the base capability name for tags from manage_categories to manage_post_tags and the corresponding edit_post_tags, delete_post_tags, and assign_post_tags.

All of these capabilities ultimately map to manage_categories so by default there is no change in the behaviour of the capabilities for categories, tags, or custom taxonomies. The map_meta_cap filter and the capabilities argument when registering a taxonomy now allow for control over editing, deleting, and assigning individual terms, as well as a separation of capabilities for tags from those of categories.

Fixes #35614
Props johnjamesjacoby for feedback

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/link-template.php

    r38645 r38698  
    931931
    932932    $tax = get_taxonomy( $term->taxonomy );
    933     if ( ! $tax || ! current_user_can( $tax->cap->edit_terms ) ) {
     933    if ( ! $tax || ! current_user_can( 'edit_term', $term->term_id ) ) {
    934934        return;
    935935    }
     
    985985
    986986    $tax = get_taxonomy( $term->taxonomy );
    987     if ( ! current_user_can( $tax->cap->edit_terms ) ) {
     987    if ( ! current_user_can( 'edit_term', $term->term_id ) ) {
    988988        return;
    989989    }
Note: See TracChangeset for help on using the changeset viewer.