• darrylyeo

    (@darrylyeo)


    As it stands, the %post_name% rewrite tag in WP Permastructure corresponds only to the slug of the current post. Given a hierarchical custom post type, can there be a way to have this tag (or an entirely new tag, say %hierarchical%) that corresponds to the entire hierarchical portion of the URL?

    Since I’m looking to remove the base slug, my Permastructure could look something like this (this rewrite tag isn’t part of the plugin):
    /%hierarchical%

    Given a hierarchical custom post type project, these:

    http://example.com/project/a
    http://example.com/project/a/b
    http://example.com/project/a/b/c

    would be rewritten as these:

    http://example.com/a
    http://example.com/a/b
    http://example.com/a/b/c

    instead of these, which is the current behavior for the /%post_name% Permastructure:

    http://example.com/a
    http://example.com/b
    http://example.com/c

    Any insights? This plugin is the closest solution I have found that could potentially solve the problem of removing base slugs from hierarchical CPT URLs. All other solutions I’ve tried from online regarding this topic are sub-optimal or cause conflicts with regular page URLs.

    https://wordpress.org/plugins/wp-permastructure/

Viewing 1 replies (of 1 total)
  • Hey darrylyeo – Did you find a solution to this? This is exactly what I need but having difficulties finding a solution?! Thanks

Viewing 1 replies (of 1 total)
  • The topic ‘Rewrite tag to remove base slug from hierarchical Custom Post Type URLs?’ is closed to new replies.