Make WordPress Core


Ignore:
Timestamp:
09/30/2016 10:39:32 PM (10 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/taxonomy.php

    r38677 r38698  
    6262                'show_admin_column' => true,
    6363                '_builtin' => true,
     64                'capabilities' => array(
     65                        'manage_terms' => 'manage_categories',
     66                        'edit_terms'   => 'edit_categories',
     67                        'delete_terms' => 'delete_categories',
     68                        'assign_terms' => 'assign_categories',
     69                ),
    6470        ) );
    6571
    … …  
    7278                'show_admin_column' => true,
    7379                '_builtin' => true,
     80                'capabilities' => array(
     81                        'manage_terms' => 'manage_post_tags',
     82                        'edit_terms'   => 'edit_post_tags',
     83                        'delete_terms' => 'delete_post_tags',
     84                        'assign_terms' => 'assign_post_tags',
     85                ),
    7486        ) );
    7587
Note: See TracChangeset for help on using the changeset viewer.