Rewrite tag to remove base slug from hierarchical Custom Post Type URLs?
-
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:https://example.com/project/a
https://example.com/project/a/b
https://example.com/project/a/b/c
would be rewritten as these:
https://example.com/a
https://example.com/a/b
https://example.com/a/b/c
instead of these, which is the current behavior for the
/%post_name%
Permastructure:https://example.com/a
https://example.com/b
https://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.
- The topic ‘Rewrite tag to remove base slug from hierarchical Custom Post Type URLs?’ is closed to new replies.