Remove Add New Post Sub Menu From Custom Post
// Remove New Post
function disable_new_posts() {
$global_settings = get_posts( 'post_type=domain_hosting' );
if ( count($global_settings) != 0 ) {
// Remove sidebar link
global $submenu;
unset($submenu['edit.php?post_type=domain_hosting'][10]);
// Hide Add new button with CSS
// * change post id to id of existing post on next line *
if ((isset($_GET['post_type']) && $_GET['post_type'] == 'domain_hosting') || $_GET['post'] == 273) {
echo '%MINIFYHTMLb8a8432e92a03a7d02f4061d76fed79384%';
}
}
}
add_action('admin_menu', 'disable_new_posts');
// Remove New Post
function disable_new_posts() {
$global_settings = get_posts( 'post_type=domain_hosting' );
if ( count($global_settings) != 0 ) {
// Remove sidebar link
global $submenu;
unset($submenu['edit.php?post_type=domain_hosting'][10]);
// Hide Add new button with CSS
// * change post id to id of existing post on next line *
if ((isset($_GET['post_type']) && $_GET['post_type'] == 'domain_hosting') || $_GET['post'] == 273) {
echo '%MINIFYHTMLb8a8432e92a03a7d02f4061d76fed79384%';
}
}
}
add_action('admin_menu', 'disable_new_posts');
// Remove New Post
//
add_action( 'admin_init', 'my_remove_menu_pages' );
function my_remove_menu_pages() {
global $user_ID;
if ( current_user_can( 'client' ) ) {
remove_menu_page( 'edit.php?post_type=domain_hosting' );
}
}
//
Comments
Post a Comment