Viewing 6 replies - 1 through 6 (of 6 total)
  • If I understand you correctly, I believe all you have to do is properly set up your Rewrite settings under Advanced Options. Set Enable Permalinks to True. For the Slug field, if the Name of your CPT is “concept,” you can leave the Slug field blank. If the Name is something else, enter “concept” (without the quotes) in the Slug field. Then your permalinks for Concept posts will be example.com/concept/post-title-slug.

    The CPT-onomies Advanced Options form follows the WordPress process for registering custom post types. You can read through that to get a better idea of what the various Advanced Options terms and settings mean.

    Whenever you make changes to your CPT-onomies, make sure to update your Permalink structure by going to Settings > Permalinks and clicking Save Changes.

    Thread Starter karnabal

    (@karnabal)

    Thank you very much jjbte, that works fine! Your explanations are very clear. ??

    I don’t know if someone can help me to have $cpt-name/$post-name even if the post is a child of another post.

    I now have this: concept/car/red-car

    but I’d prefer this: concept/red-car.

    Anyone could help me, please?

    Glad I could help.

    I’m not absolutely certain, but I think you can solve your second issue by going to Advanced Options > Rewrite and setting With Front to False for your Concept CPT. Make sure to go to Settings > Permalinks and click Save Changes after doing so. I believe that will remove “car” from your URL for “red-car.”

    Thread Starter karnabal

    (@karnabal)

    This time, it doesn’t work. Did both actions, and now I’m having: /?concept=car/red-car. It’s ok for the moment. Maybe I will ask someone to script it, if I really want it. Thanks again jjbte.

    Sorry I couldn’t be more help this time. You shouldn’t have a query string in your URL, though. To get back to what you had before (concept/car/red-car), make sure to just set Enable Permalinks to True and enter “concept” as your Slug. Make sure the other Rewrite settings are set to their default values. As always, re-save your permalink settings afterward.

    Without writing code to change the permalink structure of your Concept post type, you could disable its hierarchical setting. That would allow you to have the concept/red-car URL, but would also take away the capability of having parent-child relationships among your Concept posts.

    Thread Starter karnabal

    (@karnabal)

    Yep, I wanted to keep the hierarchical relation between posts. I will try something else. Thanks again jjbte.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘URL with $cpt-name/$post-name pattern’ is closed to new replies.