Using the CPT slug in custom rewrites
I have this rewrite rule
add_rewrite_rule('category/([^/]*)/feed/([^/]*)/([^/]*)/?', 'index.php?category_name=$matches&feed=$matches&post_type=$matches', 'top');
It uses the ID of the post type, rather than the post type slug. I’ve dug around and can’t find a way around this.
For example, for post type “Bar None” with the id “bar_none” and slug “bar-none”.
site.com/category/foo/feed/rss2/bar-none/ doesn’t work
So what intermediary step am I missing the get the slug to work in the rewrite URL?
- The topic ‘Using the CPT slug in custom rewrites’ is closed to new replies.