Last active
December 18, 2015 08:48
-
-
Save denishvachhani/5756491 to your computer and use it in GitHub Desktop.
Remove “Add New” link from custom post type
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function remove_submenus() { | |
if(!current_user_can('activate_plugins')) { | |
global $submenu; | |
unset($submenu['edit.php?post_type=your_custom_post-type'][10]); // Removes 'Add New'. | |
} | |
} | |
add_action('admin_menu', 'remove_submenus'); | |
function hide_that_stuff() { | |
if('your_custom_post-type' == get_post_type()) | |
echo '<style type="text/css"> | |
#favorite-actions {display:none;} | |
.add-new-h2{display:none;} | |
.tablenav{display:none;} | |
</style>'; | |
} | |
add_action('admin_head', 'hide_that_stuff'); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment