I have setup in my site two custom posts type : one called “france”, and another one called “fiche_pedagogique”, both are hierarchical.
I have also setup tools that allow me to set the parent of a CPT fiche_pedagogique to a CPT france. For example, if I have a CPT france with ID 123 and a CPT fiche_pedagogique can have $post->post_parent = 123.
Now, when I ask for the CPT fiche_pedagogique permalink, I get something like
http://domain.com/fiche_pedagogique/cpt-france-parent-slug/cpt-fiche-pedagogique-slug/, but this URL leads me to a 404 error.
On the other hand, the URL
http://domain.com/fiche_pedagogique/cpt-fiche-pedagogique-slug/ is working well.
How can I either make the
the_permalink() function return the correct URL, or get the first URL (with the CPT parent) work ?