Recently, one of our readers asked if it was possible to add a link to custom post type archive pages in WordPress navigation menus. An archive page in WordPress displays a list of all posts in a specific post type, category, or tag. In this article, we will show you how to add a post type file in WordPress navigation menus.
In WordPress, the term 'Archives' is used for a list of posts of a post type or taxonomy (such as categories and tags).
If archives are enabled for a custom post type, you can display them on your website. Typically, your custom post type archive page URL is in this format:
http://example.com/post-type-slug/
Slug post type is the pretty name of your custom post type.
For example, we have a custom post type called 'Deals', and you can see its archive page at a URL like this:
https://www.wpbeginner.com/deals/
You can place a link to your custom post type's archive page in your site's navigation menus. This will allow your users to see all previous posts published in that post type on a single page.
With that said, let's look at how to add a link to your custom post type archive page in your WordPress navigation menus.
First, you need to visit Appearance »Menus page. You'll notice a tab for each of your custom post types in the left column.
You need to click on the name of your custom post type to expand it and then click on the 'View All' tab.
You will see an option for your post type files. Check the box next to it and then click the Add to Menu button.
Your custom post type file will now appear as a menu item in the right column.
By default, it will use your custom post type name with the word files for the link tag.
You may want to change this to something easier. Click on the menu item to edit it and then change its navigation label.
Don't forget to click the save menu button to store your changes.
You can now visit your website to see the custom post type archive link in your navigation menu.
Like posts and pages, you can also add a single entry of your post type to the navigation menus.
Simply select an entry and then click the Add to Menu button.
Don't forget to click the save menu button to store your changes.
Custom Post Types must match some requirements in order to be displayed in Appearance »Menus page.
You first need to make sure an archive page exists for your custom post type. Typically it's a URL like this:
http://example.com/movies/
Replace example.com with your own domain name and movies with your post type.
If you can see entries for your post type on this page, it means your post type supports archives but does not support other requirements.
The good news is that you can still add your custom post type archive page as a custom link.
Visit Appearance »Menus page and then click the 'Custom Link' tab to expand it.
Enter the URL of your custom post type archive page in the URL field and add the tag you want to display in the link field.
Next, click the Add to Menu button and you will see the custom link appear in the right column.
You can now click the Save Menu button to store your changes.
We hope this article helped you learn how to add a post type file to WordPress navigation menus. You may also want to see our list of the 12 most useful WordPress tutorials on custom post types.
If you enjoyed this article, please subscribe to our WordPress YouTube Channel video tutorials. You can also find us on Twitter and Facebook.