AnsPress_Category::term_link_filter( string $url, object $term, string $taxonomy )

Description #

Filter category permalink.

Parameters #

  • $url
    string (Required) Default taxonomy url.
  • $term
    object (Required) WordPress term object.
  • $taxonomy
    string (Required) Current taxonomy slug.

Source #

File: addons/free/category.php

	public static function term_link_filter( $url, $term, $taxonomy ) {
		if ( 'question_category' === $taxonomy ) {
			if ( get_option( 'permalink_structure' ) != '' ) {
				$opt = get_option( 'ap_categories_path', 'categories' );
				return home_url( $opt ) . '/' . $term->slug . '/';
			} else {
				return add_query_arg( [ 'ap_page' => 'category', 'question_category' => $term->slug ], home_url() );
			}
		}

		return $url;
	}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment