1

I'm searching for answers, but unfortunately can't find and hope to find here.

I'm using Pods for custom post types called "players" and normal Pages for "teams", which is hierarchical, for example: page called "competition" has childs "team1", "team2"... CPT is connected to the pages with custom field.

When I'm on teams page. URL is: "mysite/competition/team1/" and everything is correct, but when I'm on players page, which belongs to "team1" URL is: "mysite/players/player_name" I want like this "mysite/competition/team1/player_name"

How can I create rewrite rule for cpt as a child of normal page. It is possible?

Thank you!

  • there are two parts to this - one, as you mention, is adding a rewrite rule to translate incoming requests into the correct query to load your team member under the desired url. the second part is generating those links any time an API request is made to get the permalink of a player, that's a separate task. you also need some means of storing which team a player belongs to, which would be the ID of the page you want the player to appear under. if you search for add_rewrite_rule and post_type_link here you'll probably find some examples to get you started. – Milo Dec 5 '14 at 22:09

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.