Inventory_Presser_Plugin::change_term_links( string $termlink, object $term )

change_term_links


Description Description

Change links to terms in our taxonomies to include /inventory before /tax/term.


Top ↑

Parameters Parameters

$termlink

(string) (Required)

$term

(object) (Required) An instance of the WP_Term class


Top ↑

Return Return

(string) A modified term link that has our post type slug prepended.


Top ↑

Source Source

File: inventory-presser.php

	function change_term_links( $termlink, $term )
	{
		$taxonomy = get_taxonomy( $term->taxonomy );

		if( ! in_array( INVP::POST_TYPE, $taxonomy->object_type ) )
		{
			return $termlink;
		}

		$post_type = get_post_type_object( INVP::POST_TYPE );
		$termlink = $post_type->rewrite['slug'] . $termlink;

		return $termlink;
	}