Need help creating routes for a custom post and the taxonomy attached to it in WordPress. I want to understand how to build a url according to the nesting hierarchy of taxonomy terms of this post. For example http://site.ru/news/sport/football/match-01

Where /news/sport/football/ are the terms of the custom post taxonomy and match-01 is the post itself. At least to start with this, then I will already attach archives to these routes, for example, if we turn to http://site.ru/news/sport/ then the archive template should be worked out and the posts sport will appear

Who cares please help with at least a link, or an example of a piece of code for rewright, I will be very grateful :)

 add_action( 'init', function(){ add_rewrite_rule( '^news/sport/football/([^/]+)?$', 'index.php?post_type=news&news=$matches[1]', 'top' ); }, 10 ); 

If you request the URL http://site.ru/news/sport/football/match-01, then everything will work out clearly, but this is all statically spelled out ... How can I dynamically substitute the terms of the dachshund ??

    0