Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@danielbachhuber
Last active April 24, 2018 06:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielbachhuber/da5d66da0b6672fd893b83b44994086d to your computer and use it in GitHub Desktop.
Save danielbachhuber/da5d66da0b6672fd893b83b44994086d to your computer and use it in GitHub Desktop.
Review of UI-based permissions based on WordPress user role

Tags

Role Assign Tags Create Modify Delete
Contributor Y Y N N
Author Y Y N N
Editor Y Y Y Y

Categories

Role Assign Categories Create Modify Delete
Contributor Y N N N
Author Y N N N
Editor Y Y Y Y

Custom Non-Hierarchical Taxonomy

add_action( 'init', function() {
	register_taxonomy( 'topic', array( 'post' ), array(
		'label' => 'Topics',
		'hierarchical' => false,
	) );
} );
Role Assign Topics Create Modify Delete
Contributor Y Y N N
Author Y Y N N
Editor Y Y Y Y

Custom Hierarchical Taxonomy

add_action( 'init', function() {
	register_taxonomy( 'section', array( 'post' ), array(
		'label' => 'Sections',
		'hierarchical' => true,
	) );
} );
Role Assign Sections Create Modify Delete
Contributor Y N N N
Author Y N N N
Editor Y Y Y Y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment