Skip to content

Instantly share code, notes, and snippets.

@yawalkar
Forked from pdewouters/gist:4526457
Created January 25, 2017 13:12
Show Gist options
  • Save yawalkar/d63020d428c1eec3bdae5d7fb9a2e1f1 to your computer and use it in GitHub Desktop.
Save yawalkar/d63020d428c1eec3bdae5d7fb9a2e1f1 to your computer and use it in GitHub Desktop.
Remove the 'View' link from the admin bar for a custom post type
/**
* removes the 'view' link for CPT in the admin bar
*/
function pdw_admin_bar_render() {
global $wp_admin_bar;
if('client' == get_post_type()){
$wp_admin_bar->remove_menu('view');
}
}
add_action( 'wp_before_admin_bar_render', 'pdw_bij_admin_bar_render' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment