As a WordPress site owner, you may have set up custom post types to organize and display different content types beyond standard blog posts and pages.
To provide intuitive navigation for these content sections, it‘s important to understand how to work with post type archives in your WordPress menus.
In this complete guide, we‘ll cover everything you need to know as a site owner or WordPress developer when it comes to adding post type archive links to your menus for optimal user experience and SEO.
Contents
- Why Post Type Archives Matter for Website Navigation
- Requirements for Post Type Archives to Appear in Menus
- How WordPress Generates Post Type Archive Pages
- Step-by-Step: Adding a Post Type Archive to Your Menu
- Best Practices for Post Type Archives in Menus
- Advanced: Customizing Archive Listings Further
- Troubleshooting Post Type Menus and Archives
- Wrapping Up
First, let‘s look at why linking to post type archives from your menus can benefit your site.
According to WordPress usage statistics, over 20% of sites leverage custom post types to power diverse content like directories, real estate listings, team profiles, and more.
With all of these different content sections that go beyond standard posts, maintaining clear and organized site navigation is essential. This allows users to easily browse and discover content.
Adding archive links provides direct access points to listing pages for all posts of that type. For example, your "Locations" custom post type could have an archive at:
example.com/locations
This gives users an immediate way to view all location entries.
Here are some key benefits of adding post type archives to your menus:
-
Improved user experience – users can more easily navigate and consume all post type content in one place.
-
Better content structure – post type archives reinforce content sections and hierarchies within your overall site navigation.
-
Enhanced discoverability – archive links allow users to find related posts by type that they may not encounter otherwise.
-
Stronger SEO – unique archive pages and menu links provide more entry points that search engines can crawl and index.
Overall, incorporating post type archive links creates more organized menus that reflect your full website content structure.
Requirements for Post Type Archives to Appear in Menus
Now that we‘ve covered their importance, let‘s look at how post type archives are generated and accessed in WordPress.
For an archive page to be available for a post type and show up as a menu option automatically, a few conditions must be met:
-
The post type must be publicly queryable – the
publicargument when registering the post type must be true (default). This allows it to have archive pages. -
The post type must have archives enabled – the
has_archiveargument when registering the post type must be true. This generates the archive URL and template. -
It needs the
show_in_nav_menusargument set to true (default) when registered. This displays it in the menu editor.
Without these, you may need to add the archive URL manually as a custom link instead, which we‘ll cover below.
How WordPress Generates Post Type Archive Pages
Under the hood, here is what happens automatically when WordPress builds archives for registered post types:
-
A rewrite rule is created that points the post type‘s archive slug to
index.php. For example,/locations/would hitindex.php. -
The main query is populated with the posts of that type when on the archive URL page.
-
A query var
post_typeis added containing the post type name so templates know which posts to display. -
The
archive-{post_type}.phptemplate file is used if present, falling back toarchive.php.
So in summary, the archive URL, rewrite rule, and templates all work together to dynamically display the post type posts.
Now let‘s see how to connect these archives to your menus.
Step-by-Step: Adding a Post Type Archive to Your Menu
Adding a post type archive link to your WordPress navigation menus is simple. Just follow these steps:
-
In your WordPress dashboard, go to Appearance > Menus.
-
In the left sidebar, find the post type you want to add and expand it.
-
Check the box next to View All to select the archive page.
-
Click Add to Menu to add this post type archive link to the current menu.
-
The archive will now appear in the right-hand menu structure box. Drag it into place within your menu.
-
Once your menu looks complete, click Save Menu at the bottom to apply changes.
Now your post type archive link will appear in the theme menu location it‘s assigned to on the front-end of your site.
Adding Post Type Archives as Custom Links
In some cases, your post type‘s archive may not show up automatically in the menu editor.
This can happen if:
has_archiveis disabled for the post type.show_in_nav_menusis false.- There are theme menu limitations.
If that happens, don‘t worry – you can manually add the post type archive URL as a custom menu link instead:
-
Expand the Custom Links section in the menu editor sidebar.
-
Enter your full post type archive URL into the URL field.
-
Add the menu link text – e.g. "Products" – in the Link Text field.
-
Click Add to Menu to add this link.
-
Position the custom archive link within your menu structure.
-
Save the menu when ready.
Even without automatic archive integration, you can link any URL.
Best Practices for Post Type Archives in Menus
Now that you know how to add post type archives to menus, let‘s cover some best practices to optimize your site navigation UX.
Use Clear, Descriptive Labels
Don‘t just use your post type slug or vague labels like "Blog". Instead, help users understand where the archive link will take them.
For example, use:
✅ "Recipes"
❌ "Recipes Archive"
Style Archive Links for Clarity
Many themes allow styling menu items differently. Use this to make post type archive links stand out, like with:
- Icons – e.g. spoon icon for recipe archive.
- Badges – e.g. number of posts.
- Color – visually distinguish archive links.
This helps identify the archive role at a glance.
Consider Mixed vs Separate Menus
You can mix post type archives into your main menu or create separate menus for each content section. Evaluate your site structure and goals.
Separate menus may work well for:
- Large sites with very distinct sections.
- Different audiences and user flows.
- Avoiding overly long menus.
Enable Menu Item Descriptions
Some themes support menu item descriptions that appear on hover or focus. Use this to provide more context about where an archive link leads.
For example:
View all recipes posted on our site.
This provides helpful guidance for menu navigation.
Advanced: Customizing Archive Listings Further
As you become comfortable working with post type archives in your menus, you may want to customize the archive listing pages further.
Here are some possibilities to explore:
- Using custom archive templates – create
archive-myposttype.php. - Installing plugins like Archive Post Type for layout control.
- Filtering by date, category, or other taxonomies if relevant.
- Adding intro text, featured images, and other metadata.
- Customizing the loop query and markup.
- Pagination or load more functionality for long lists.
This allows you to build more robust archive hubs for browsing all of a post type easily.
Troubleshooting Post Type Menus and Archives
Sometimes you may run into issues getting post type archives to appear properly in menus. Here is some troubleshooting guidance:
Archive not showing in menu editor
- Ensure
has_archiveis true when registering the post type. - Check that
show_in_nav_menusis enabled for the post type. - Try adding as a custom link instead.
404 error on archive URL
- Confirm the permalink structure supports post type archives.
- Regenerate rewrite rules by saving permalinks again.
No posts showing on archive
- Check your theme‘s
archive.phporarchive-{posttype}.phptemplate. - Make sure the main query is set up to fetch that post type.
- The post type may not be publicly queryable – double check
publicargument.
Styling not applying to menu item
- Your theme must support custom menu item styling. Check for available options.
- Try a plugin like Nav Menu Roles for more styling control.
Hopefully these tips help you diagnose any potential issues displaying your post type archives in menus.
Wrapping Up
In closing, adding your WordPress post types‘ archive pages to your navigation menus provides a more intuitive experience for site visitors.
It enables easy access to listing pages for all posts of that type, reinforcing your overall content structure and discoverability in a clear way.
Just remember:
- Post types need proper archive support to appear automatically.
- You can also add archives manually as custom links.
- Follow best practices for labels, styling, organization.
- Customize further to build robust archive hub pages.
We hope this guide gave you a comprehensive overview of working with post type archives in your WordPress menus! Let us know if you have any other questions.
