For my custom post type,i had set the ‘hierarchical’ to true for my url to be like
http://example.com/custom/parent/child/.But there is this part in the WordPress codex.
Note: this parameter was planned for Pages. Be careful, when choosing it for your custom post type – if you are planning to have many entries (say – over 100), you will run into memory issue. With this parameter set to true WordPress will fetch all entries of that particular post type, together with all meta data, on each administration page load for your post type.
Does this means that its better not to set it to true,if i will have a lot of child pages? And if I don’t use the hierarchical, how could I make the URL to be like the one above?
….if you are planning to have many entries (say – over 100), you will run into memory issue
Any hierarchical post type (even the build-in post type
page) have this issue where a large amount of posts created have a huge impact on performance. This issue is experienced in the back end, and not in the front end. Having too much posts can lead to your back end page timing out, triggering a fatal error which leads to the dreaded WSOD. I have explained everything in my answer here, so be sure to check it out.
So in short, you can use a hierarchical post type for your project, but you need to be very sure that you will not have a lot of posts.
You can make use of a non hierarchical post type (like the build-in type
post) with a hierarchical taxonomy like the build in taxonomy
category. This way you make use of the parent/child relationship between terms. What will be an issue though is to create the URL structure you are after. This will definitely require custom rewrite rules.
One way or the other you are going to have issues, some of them will be easy to solve, others might be a bit more challenging. You will definitely need to go and work on a plan and make sure you have everything in place before you dive into the deep end. Once you are in the deep water, there is basically no turning back