Removing or Rewriting %postname% in Custom Post Type Permalink
-
Main Questions: Is there some way to display the permalink for a custom post type WITHOUT using %postname% in the permalink structure? Or is there a way to change %postname% so that when the permalink structure is generated it shows the post title instead?
Scenario: I’m building an inventory system using WordPress and am looking at ways to setup a custom permalink structure. I’ve managed to get most of the pieces in place but am currently hitting a wall regarding %postname%.
To start, I have a custom post type which tracks the product. A product can be re-printed or re-released and have some differences from earlier versions. To track the releases, I’ve setup a url structure like so: example.com/%versionnumber%/%postname% where %versionnumber% is pulled from a post meta field.
The issue here is that two products named “hello” will be displayed as “hello” and “hello-2” respectively. Given that %versionnumber% is going to make the URL unique I’d like to use the post title instead of the post name.
I’m also open to a completely different approach – this is just the one I’ve locked onto at the moment.
Any help is appreciated! Thanks,
- The topic ‘Removing or Rewriting %postname% in Custom Post Type Permalink’ is closed to new replies.