WP Manifestindependent plugin directory
manifest / content / posttype-term-archive

PostType Term Archive

Allow URLs like /<post_type>/<taxonomy>/<term_slug> in Wordpress

by Jörn Lund · github.com/mcguffin/posttype-term-archive · website

4stars
47release downloads
0forks

Install

The author publishes release zips, so WP-CLI can install straight from GitHub:

wp plugin install https://github.com/mcguffin/posttype-term-archive/releases/download/0.3.11/posttype-term-archive.zip

Declares an update source (mcguffin/posttype-term-archive), so updates arrive through the plugin's own updater.

Readme

PostType Term Archive

Allow pretty Archive-URLs with custom post types, taxonomies and terms.

Usage

Registering a post type taxonomy archive:

do_action('register_post_type_taxonomy', 'book', 'publisher' );

Doing the same, but show some links in WP Menu editor:

do_action('register_post_type_taxonomy', 'book', 'publisher', true );

Same as above

do_action('register_post_type_taxonomy', 'book', 'publisher', array(
    'show_in_menu'  => true,
) );

Same as above but allow admin to disable the archive in permalink settings

do_action('register_post_type_taxonomy', 'book', 'publisher', array(
    'show_in_menu'      => true,
    'show_in_settings'  => true,
) );

Disable configurability entirely:

// filter must be added before or during `plugins_loaded`
// best is to put in mu-plugin, like wp-content/mu-plugins/some-file.php
add_filter( 'posttype_term_archive_settings', '__return_false');

Getting a specfic post type term archive URL:

$post_type = 'book';
$term_id = 123;
$term_slug = 'rainbow-press';
$taxonomy = 'publisher';
$term_object = get_term( $term_id, $taxonomy );

// All these will return something like http://my-site.tld/book/publisher/rainbow-press
// note that when you pass the term as slug, you'll have to pass the taxonomy also.
// will return WP_Error if $post_type + $taxonomy has not been registered first.

$url = apply_filters( 'post_type_term_link', '', $post_type, $term_object );

$url = apply_filters( 'post_type_term_link', '', $post_type, $term_id );

$url = apply_filters( 'post_type_term_link', '', $post_type, $term_slug, $taxonomy );

ToDo

  • [ ] Add Archive URLs to WPSEO.
  • [ ] More Testing with different Polylang setups.
  • [ ] Refactor: put frontend nav menu to standalone singleton

Read the full README on GitHub →

Releases

TagPublishedAssetDownloads
0.3.11 Nov 12, 2020 posttype-term-archive.zip 3
0.3.10 Dec 18, 2019 posttype-term-archive.zip 2
v0.3.9 Nov 8, 2018 posttype-term-archive.zip 3
v0.3.8 Oct 9, 2018 posttype-term-archive.zip 2
v0.3.7 Oct 9, 2018 posttype-term-archive.zip 2
v0.3.6 Oct 9, 2018 posttype-term-archive.zip 2
v0.3.5 Oct 9, 2018 posttype-term-archive.zip 2
v0.3.4 Oct 9, 2018 posttype-term-archive.zip 2
v0.3.3 Oct 9, 2018 posttype-term-archive.zip 2
v0.3.2 Oct 9, 2018 posttype-term-archive.zip 2
v0.3.1 Oct 9, 2018 posttype-term-archive.zip 2
v0.3.0 Oct 9, 2018 posttype-term-archive.zip 2
v0.2.2 Oct 8, 2018 posttype-term-archive.zip 2
v0.2.1 Oct 8, 2018 posttype-term-archive.zip 2
v0.2.0 Oct 8, 2018 posttype-term-archive.zip 2
v0.1.6 Jul 26, 2018 posttype-term-archive.zip 2
v0.1.5 Jul 3, 2018 posttype-term-archive.zip 2
v0.1.4 Jun 28, 2018 posttype-term-archive.zip 2
v0.1.3 Jun 28, 2018 posttype-term-archive.zip 3
v0.1.2 Jun 28, 2018 posttype-term-archive.zip 2
v0.1.1 Jun 16, 2018 posttype-term-archive.zip 2
v0.1.0 Jun 16, 2018 posttype-term-archive.zip 2