I'm trying to add a custom link under my Post Type in my admin menu, which will link to Pending Posts. This code functions, but it instead makes a page (like I suppose the function should), but I just need a single link and there doens't seem to be a add_submenu_link function unfortunately. Is there a way to create a static link but place it in my post type submenu?

/** Add Pending Posts to WP Admin Menu **/
function add_custom_link() {
    add_submenu_page('edit.php?post_type=cpt_custom', '', 'Pending Posts', 5, __FILE__, 'sub_page_pending');
function sub_page_pending() {
  echo '<li><a href="edit.php?post_status=pending&post_type=cpt_custom">Pending Posts</a></li>';
add_action('admin_menu', 'add_custom_link');

I've tried to use a wp_redirect() but I get some errors telling me that the headers have already been set.


Insert the URL of the page as the $menu_slug argument. Also note that user levels are deprecated, you should pass a capability instead.

function add_custom_link() {
        'Pending Posts',
add_action('admin_menu', 'add_custom_link');
| improve this answer | |
  • 1
    The link kept going to my root, so I had to add a / at the front of my link, but it works! – Howdy_McGee Feb 14 '14 at 18:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.