1

I installed a TV SHOW plugin on my WordPress install. URLs are like this:

https://www.mywebsite.com/tv-show/title-of-tvshow

Now I would like to add a specific tag to redirect the user to the right TV show season like this:

https://www.mywebsite.com/tv-show/title-of-tvshow/season/3

This code doesn't seem to work and creates a new set of URLs instead of adding the new %season% tag to the plugin existing permalink structure

       global $wp_rewrite;
        $wp_rewrite->add_rewrite_tag('%tv-show%', '([^/]+)', 'tv_show=');
        $wp_rewrite->add_rewrite_tag('%season%','([^&]+)', 'season=');
        $wp_rewrite->add_permastruct('tv-show', '/tv-show/%tv-show%/%season/');

        $wp_rewrite->flush_rules();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.