Taxonomy: Introduce pre_term_link filter.

This filter allows developers to filter the taxonomy permalink
structure before a term's permalink is generated. It parallels
the 'pre_post_link' filter for the 'post' post type.

Props nikeo.
Fixes #39601.

git-svn-id: https://develop.svn.wordpress.org/trunk@41191 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Boone Gorges 2017-07-30 15:09:31 +00:00
parent 37a8fe8b9b
commit d7ce3e77e9

View File

@ -3932,6 +3932,16 @@ function get_term_link( $term, $taxonomy = '' ) {
$termlink = $wp_rewrite->get_extra_permastruct($taxonomy);
/**
* Filters the permalink structure for a terms before token replacement occurs.
*
* @since 4.9.0
*
* @param string $termlink The permalink structure for the term's taxonomy.
* @param WP_Term $term The term object.
*/
$termlink = apply_filters( 'pre_term_link', $termlink, $term );
$slug = $term->slug;
$t = get_taxonomy($taxonomy);