WordPress plugin intelligence profile

Post Type Archive Pages

Place the archive pages for your post types in the structure of your content pages. The power of pages and post types combined!

WP PlugIndex snapshot

Current directory snapshot

Tested up to WordPress 5.3
Current version1.0.4
WordPress coverageTested up to WordPress 5.3
Minimum stackWP 5.0 · PHP 5.6
Directory statusactive
Last directory update30 Jan 20206y ago
Active installations200Adoption metric — not a quality score
WordPress.org rating5.0 / 5 from 1 ratings
Official packageDirect from WordPress.org

Repository metrics are context, not quality scores. Active installations measure adoption and can strongly reflect a plugin’s age and historical popularity. Ratings, recent updates and “Tested up to” metadata also do not guarantee modern code, error-free operation, security, feature completeness or suitability for a particular site. Why active installs don’t tell the whole story →

WP PlugIndex currently records Post Type Archive Pages version 1.0.4 as active, updated 6y ago and tested up to WordPress 5.3.

Overview

About this plugin

Post Type Archive Pages allows you to select pages from within your content page structure to be the archive pages for your custom post types. This gives you control of the permalink for your archive pages and allows them to be nested under other pages. It also sets the permalink base for single posts of that post type and term archive for the post type’s taxonomies.

Once the plugin is installed and activated you’ll be able to select the archive page for each of your registered post types under Settings > Reading.

Templating

WordPress will look for archive page templates for the pages that you set as archive pages. php.

There are also a few functions available that may be helpful in building themes. They are accessed on the plugin’s main instance, which is returned by a call to post_type_archive_pages().

get_archive_page

Returns the page object for the archive page of the provided post type slug. If called from a post type archive template, a singular template or a term archive and a slug isn’t provided, the relative post type will be used. g.

$page = post_type_archive_pages()->get_archive_page('book');

get_archive_page_post_type

Returns the post type object that the provided page ID is the archive page for. g.

$postType = post_type_archive_pages()->get_archive_page_post_type(5);

Menu – Enhancements

Archive pages added to the menu will be marked as the current menu item when viewing the post type archive and the current menu item’s parent / ancestor when viewing a post of that type. The related CSS classes will also be applied.

Advanced Custom Fields – Enhancements

This plugin is particularly effective when paired with Advanced Custom Fields. It registers additional page type location rules allowing you to add fields to all archive pages or the archive page for a particular post type. So if your listing page requires content like a description or header image you can place fields for those on the archive page itself.

To access fields like these in your archive template you need only call

$desc = get_field( 'description', post_type_archive_pages()->get_archive_page() );

Developer Hooks

The plugin attempts to set defaults that should work best for most scenarios. But there are some places to hook in and alter these defaults where needed.

Filter – post_type_archive_pages/supported_post_types

By default you will be able to set an archive page for any public post type other than the built in post types of page and post. This hook allows you to filter the default array of supported post types to add or remove. The array should contain slugs of valid post types.

Please note that the array keys are not important in it’s use, but contain the slugs to allow you to easily unset values.

add_filter( 'post_type_archive_pages/supported_post_types', function( $post_types ){ unset( $post_types['book'] ); return $post_types; } );

Filter – post_type_archive_pages/taxonomy_post_type

By default taxonomy term archives will inherit the archive page permalink structure of a post type if that post type is the only one that the taxonomy is registered on. For instance if you had a publisher taxonomy the permalink for a term archive might become /books/publisher/penguin. With /books being the permlaink of the archive page, publisher the taxonomy slug and penguin the term slug.

This filter allows you to alter the post type who’s archive page permalink structure will be inherited for a given taxonomy.

add_filter( 'post_type_archive_pages/taxonomy_post_type', function( $post_type, $taxonomy ){ if ( $taxonomy === 'publisher' ) return null; return $post_type; }, 10, 2 );

WordPress.org metadata

Plugin tags

Topics listed for this plugin in the WordPress.org directory.

  • archive pages
  • post types
Compatibility & maintenance

Compatibility & maintenance

Tested up to WordPress 5.3

Not yet marked as tested with WordPress 7.1. WordPress.org currently lists Tested up to 5.3.

Current WordPress releaseWordPress 7.1
WordPress.org Tested up to5.3
Minimum requirementsWordPress 5.0 · PHP 5.6
Update activity30 Jan 20206y ago

“Tested up to” is directory metadata supplied by the plugin author. WP PlugIndex does not turn an older declaration into a claim that the plugin is incompatible.

Changes recorded by WP PlugIndex

Recent tracked changes

No tracked version or compatibility changes have been recorded by WP PlugIndex yet.

Tracking & source

WP PlugIndex tracks public WordPress.org directory metadata and records selected version, compatibility and availability changes as they are detected.

Plugin watchlist

Watch this plugin

Sign in to your WP PlugIndex account or create a free account. Free accounts can watch up to 5 plugins and see what changed.

Watch limit

Watchlist limit reached

You have reached your current active watch limit.