Categories::term_link_filter( string $url, object $term, string $taxonomy )
Description #
Filter category permalink.
Parameters #
- $urlstring (Required) Default taxonomy url.
- $termobject (Required) WordPress term object.
- $taxonomystring (Required) Current taxonomy slug.
Source #
File: addons/categories/categories.php
public function term_link_filter( $url, $term, $taxonomy ) {
if ( 'question_category' === $taxonomy ) {
if ( get_option( 'permalink_structure' ) !== '' ) {
$opt = get_option( 'ap_categories_path', 'categories' );
$default_lang = '';
// Support polylang permalink.
if ( function_exists( 'pll_default_language' ) ) {
$default_lang = pll_get_term_language( $term->term_id ) ? pll_get_term_language( $term->term_id ) : pll_default_language();
}
return home_url( $default_lang . '/' . $opt ) . '/' . $term->slug . '/';
} else {
return add_query_arg(
array(
'ap_page' => 'category',
'question_category' => $term->slug,
),
home_url()
);
}
}
return $url;
}
Expand full source code Collapse full source code View on GitHub: addons/categories/categories.php:393
Add your comment