I have multiple custom post types which I nested thanks to a plugin and post I found. I have a custom post type 'landen' ( which should be the parent post type ) and a child post type 'rondreizen', which should be a sub of the custom post type 'landen'.

When creating a new post in the custom post type 'rondreizen' it creates the perfect url

landen/land/rondreizen/rondreis (archive/single/archive/single)

I created an archive-landen.php and when I go to http://example.com/landen I arrive on the archive-landen.php page, as well for http://example.com/landen/land I arrive on the single-landen.php.

What I'm trying to achieve is that when you arrive on landen/land/rondreizen it should go to an archive page of the 'rondreizen' child custom post type. But how can I do this? What is the right page template which refers to archive/single/archive? This problem is bugging me for days already and I can't figure it out how to do it. I'm not very familiar with this yet, as well with the Rewrite API.

EDIT: I answered my own question. Solved the problem myself.

  • Are you asking how to override or create your own archive template for rondreizen? There is no Archive > Single > Archive. It's either an archive or either single. So when you want to overwrite an archive, it's not taking into account that it's a "child" post type of something else, it's only looking at the taxonomy/post type that it needs to be archived by. You'd have to create an archive-rondreizen.php file if you want to override archive.php. This might help: codex.wordpress.org/…
    – RachieVee
    Commented Nov 26, 2014 at 20:45
  • I did this, but I now have 2 different URLs. landen/land and rondreizen. Will it be possible to concatenate those to landen/land/rondreizen ?
    – marciano
    Commented Dec 1, 2014 at 10:36
  • From re-reading the question, it appears you have landen/ and landen/land working using archive-landen.php correct? Perhaps instead of custom archive templates, what you need is conditionals within the archive.php to switch post types. Take a look at: codex.wordpress.org/Conditional_Tags#A_Post_Type_Archive Also take a look at: wordpress.stackexchange.com/questions/6731/…
    – RachieVee
    Commented Dec 3, 2014 at 20:14
  • Finally for an idea of how to do this, I wrote a tutorial about sub-categories and using the archive.php - it's different from custom post types but it's the same concept for conditionals: rachievee.com/… In your case, instead of checking for categories, you'd be checking for your custom post types and loading your loop/styles due to that. Once again this is assuming that what you said about /landen and /landen/land working the way it should so you'd make the same re-write fixes as you did there to rondreizen. Good luck!
    – RachieVee
    Commented Dec 3, 2014 at 20:16
  • Thanks for thinking with me, but I found the answer!
    – marciano
    Commented Dec 11, 2014 at 9:39

1 Answer 1


I found out how to solve this problem, and I hope I can help others in future.

My goal was to create an url structure like this: landen/land/rondreizen, with the use of multiple custom post types. 'landen' and 'rondreizen' are both custom post types. The templating structure should wordpress-like, act like this archive/single/archive. After long searching I found this tutorial on how to fix it, and it worked like a charm. However, there is one little pitfall which may prevent it from working somehow which I haven't found out yet, but note that when you rewrite the url with your 'nested' custom post type name, it doesn't work, so you need to register your custom post type under a different name from the url name you are rewriting.

If you want to have even deeper custom post type links, I suggest looking at this post.

Leave a comment if someone need help with this, and I'll try to help.

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.