• Hi , I am trying to remove the “add” link from some of my post types. Find som code that remove the add link from de “main/side menu” but there is still a add link at the top of the page when I wiew the post, how can I remove that?

    This is the code that removes the add link from the menu…

    function disable_new_posts() {
        // Hide sidebar link
        global $submenu;
        unset($submenu['edit.php?post_type=footer'][10]);
    
        // Hide link on listing page
        if (isset($_GET['post_type']) && $_GET['post_type'] == 'footer') {
            echo '<style type="text/css">
            #favorite-actions, .add-new-h2, .tablenav { display:none; }
            </style>';
        }
    }
    add_action('admin_menu', 'disable_new_posts');
Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    It doesn’t appear possible to do this cleanly with PHP. Your best bet is to use javascript to change the HTML or CSS after the page loads.

Viewing 1 replies (of 1 total)

The topic ‘Remove add link for custom post type’ is closed to new replies.