generating post slug with info other than post title
I’m trying to set up a directory of people using custom post types and taxonomies.
I’ve removed support for the title for the custom post type because I just want the user’s display name to act as the title. Additionally, the user is limited to creating just 1 post of that type.
The title is no problem, and easy enough for me to change in the template.
However, upon publishing, the slug generated is something like “auto-draft-1” making the URL look like “http://localhost/mysite/mycustomposttype/auto-draft-1/”
I’m trying to get it to be “http://localhost/mysite/mycustomposttype/username/” or “http://localhost/mysite/mycustomposttype/display-name/”
I see that the slug generation happens upon publishing the post so I’ve looked into the wp_unique_post_slug function in wp-includes/post.php, lines 2800-2857, to see how it works but I’m out my depth here.
Can anyone point me in the right direction?
- The topic ‘generating post slug with info other than post title’ is closed to new replies.