Skip to content

Instantly share code, notes, and snippets.

@cgrymala
Created May 18, 2016 16:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cgrymala/41fe14ebf589d3f209c0bcf4da38d65d to your computer and use it in GitHub Desktop.
Save cgrymala/41fe14ebf589d3f209c0bcf4da38d65d to your computer and use it in GitHub Desktop.
Modifies WordPress Admin Menu to adjust cap used for specific menu
add_action( 'admin_menu', 'adjust_admin_menu', 11 );
function adjust_admin_menu() {
$test_slug = 'my-menu-slug';
$new_cap = 'edit_posts';
global $menu;
foreach ( $menu as $k=>$v ) {
if ( $test_slug == $v[2] ) {
$menu[$k][1] = $new_cap;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment