Hook to change Custom Tag Taxonomy Links?

I have a Custom Post Type named News that has a URL structure like this…


I have also added a Custom Tag Taxonomy for my News Post Type.

Here is my Re-write settings for it…

$news_posts_tag_args = array(
        'rewrite' => array(
                'slug'                       => 'news-tag',
                'with_front'                 => false,
                'hierarchical'               => true,

This makes mt News Tag have a URL like this…


However I would like my it to appear that I have tag under my News Post Type

So that it will instead be like this…


I am able to achieve this by using the Re-write code below…

function custom_taxonomies_rewrite(){

So far everything works great but I then have to make sure to edit anything that links to the News Tag Taxonomy to make sure it uses my new custom URL structure for that Taxonomy.

So I am hoping someone can help me with the next step of my process by helping to to hook into Tag links so maybe I can change the links more easily?

Solutions Collecting From Web of "Hook to change Custom Tag Taxonomy Links?"

If anyone else is looking for this in the future, the result I came up with is this one…

/* Filter Custom Taxonomy Tag HTML Links */
function custom_term_link_url($content) {
    $current_path = 'news-tag';
    $new_path = 'news/tag';
    $content = str_replace($current_path, $new_path, $content);
    return $content;
add_filter('term_link', 'custom_term_link_url');

It will run code on Taxonomy Links. I still need to add in functionality to work with more then 1 custom taxonomy but this is a good start and works for 1