• SO, I’m having an issue where I need to rewrite a hierarchical custom post type. The custom post type is called “Destinations” and it hold regions, countries, and holidays. There is already content on the site so I can’t redo this functionality.

    The current structure goes 4 levels deep:

    /destinations/{region}/{country}/{holiday}/
    Each level has it own design type.

    What I need is:

    {region}/
    {region}/{country}/
    {country}/{holiday}/
    Destinations is completely removed from the URL and the URL level are restricted to 2 levels.

    Is there anyway of doing this within WordPress?

Viewing 1 replies (of 1 total)
  • Richard

    (@richardcoffee)

    You should be able to achieve this using the rewrite api at https://codex.wordpress.org/Rewrite_API

    I have used this with some success, but am no expert by any means. I have always had to experiment some to get the results I want. Sounds like you may want to use the ‘{$permastruct}_rewrite_rules’ hook.

Viewing 1 replies (of 1 total)

The topic ‘Rewriting hierarchical post type’ is closed to new replies.