I previously wrote a question about rewriting a URL based on an originating URL and Milo provided me with a working answer for pages/posts. But now I am trying to do a taxonomy rewrite and the same functionality seems to break things.

Here is my code:

function lqd_series_link( $term_id, $taxonomy ) {
  if ( $taxonomy == 'gc-sermon-series' && isset( $wp_query->query_vars['app-view'] ) ) {
    return $taxonomy; // I've also tried $link
  return $taxonomy;
add_filter( 'term_link', 'lqd_series_link' );

What is strangest is what this results in. So if I do the code as Milo instructed on the question linked above I end up with a URL for pages like:


But when I use the above code I end up with the same exact thing:



  • Your examples are the same Jan 24, 2018 at 23:56
  • @JacobPeattie - Yes, that is what ends up happening. In both cases it creates the same exact link view...which is what I can't understand.
    – davemackey
    Jan 25, 2018 at 1:04

1 Answer 1


The term_link filter has a different signature for its callback function than the page_link filter, meaning the arguments in your callback are different. (Also note you'll need to explicitly set the argument number when you call add_filter because by default add_filter will only setup 1 argument. For example:

add_filter( 'term_link', 'lqd_series_link', 10, 3 ); // Where 3 is the number of arguments for your callback function

Then in your callback:

function lqd_series_link( $url, $term, $taxonomy ) {
    global $wp_query;
    if ( $taxonomy == 'gc-sermon-series' && isset( $wp_query->query_vars['app-view'] ) ) {
        return $url . 'app-view/';
    return $url;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.