I'm creating a WordPress site that has 3 custom post types registered: course, chapter, and lesson.

All of these post types are inter-connected and share a relationship using custom fields. For example, the chapter has a custom field that stores the course post object in which it belongs to. Same goes for the lesson and the chapter it belongs to.

My permalink settings are using the: %category%/%postname%/ structure, in which display the post's URL like so:


What i'm trying to accomplish is to create a custom permalink structure that shows the relationship between these 3 post types in the URL. Example below:

When user is on course: www.domainname.com/course

When user is on a chapter: www.domainname.com/course/chapter

When a user is on a lesson: www.domainname.com/course/chapter/lesson

While looking in the WordPress Codex, I found the the Rewrite API and WP_Rewrite(), I'm a little lost and i do not know where to begin.

Any help on this would be greatly appreciated.

  • This should get you started in the right direction. Try it and don't forget to flush your rewrite rules. Then, if you still need help, post back with details about what you tried and the specific issues you're experiencing.
    – cfx
    Commented Aug 17, 2014 at 1:55

1 Answer 1


Please note that if you have lessons that are in multiple chapters you will create duplicate content.

If you want an easy way to connect these post types you can use a free plugin called Post Connector: http://wordpress.org/plugins/post-connector/

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.