Timeline for How to allow different authors to use same post slug?
Current License: CC BY-SA 4.0
7 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Nov 8, 2018 at 21:14 | answer | added | HBCondo | timeline score: 0 | |
Nov 7, 2018 at 0:58 | comment | added | HBCondo | Thank you for these suggestions. We already imported over 200K posts using the standard post type. We may just specify the author id in the post_parent field so we can achieve having the same post_name for different authors. Thoughts on this approach? Adding custom fields for our large post count may not be feasible and rewriting doesn't really solve the problem of WP appending -2 to post_name. | |
Nov 1, 2018 at 19:42 | comment | added | Sally CJ |
I'd say assign a custom field to the posts, maybe name it author_post_slug and give it the same value (e.g. post_slug ), and filter the URL requests via parse_request , or create custom rewrite rules for those URLs.
|
|
Nov 1, 2018 at 14:31 | comment | added | WebElaine | That's your problem - you cannot have duplicate slugs in a non-hierarchical post type like Post. WP looks at the slug first to determine what content to display, and if there's more than one - and they don't have a parent - it would not know which to display. To get URLs like this you will have to use a hierarchical post type. | |
Oct 31, 2018 at 22:52 | comment | added | HBCondo | Thank you for your reply. This is indeed for non-hierarchical post types but these are for standard WordPress posts (not custom), not pages. | |
Oct 31, 2018 at 21:18 | comment | added | WebElaine | It sounds like you're using a non-hierarchical post type. As long as you are using Pages, or a CPT such as perhaps "author" that is hierarchical, WP will allow duplicate child slugs as long as the top-level pages (author1, author2) have unique slugs. | |
Oct 31, 2018 at 20:09 | history | asked | HBCondo | CC BY-SA 4.0 |