I’ve created a Custom Post type (project) and it works perfectly. I have a custom archive page (archive-project.php), and that works great, too, but what’s the best way to add a link to that custom post archive in the site’s primary menu?

I’ve created a Custom Link (see below), but is there a better way that isn’t so hard coded?

enter image description here

1

You can use a built in function of the menu editor for this. Go to your Custom Post Type in the Menu editor, click the “view all” tab and the first item you see is a link to the CPT archive page.

add custom post type archive to menu

In case your CPT does not appear in the Menu editor please check whether your CPT has archives enabled ('has_archive' => true in the register_post_type-arguments).

When you are sure that archives are enabled and your CPT is still not visible you can reveal it through the Screen Options menu at the top of the screen (thanks, Nathan Hornby).

reveal Custom Post Types via Screen Options menu

Leave a Reply

Your email address will not be published. Required fields are marked *