Question: Wordpress and custom slug

Question

Wordpress and custom slug

Answers 0
Added at 2016-12-31 17:12
Tags
Question

I'm trying to reach following situation in WordPress:

  • slug names can be duplicated between authors (one author can't have same slug twice of course)
  • permalink should be like domain.com/AUTHOR-TITLESANITIZED (no casesensitive)

If I set custom permalink:

/%author%-%postname%/

it works almost.

But if Author1 has made post with title "Unique" and Author2 writes a post named "Unique", WP automatically changes it to "Unique-2" (then its like /author2-unique-2/ and it gives 404 also, maybe because last dash is not sanitized).

I need to have following:

  • tld.com/author1-post
  • tld.com/author1-post2 (2 should be added automatically here by WP)
  • tld.com/author1-uniquepostname
  • tld.com/author2-uniquepostname
  • tld.com/author2-post
  • tld.com/author3-uniquepostname

and so on.

Hopefully somebody can help me?

EDIT: Web server is Apache and SEO-ranking doesn't matter in this case. Also WP's frontend search is not in use, only direct links are ok, not even LIKE. So it just have to work, everything else is not important :)

Answers
Source Show
◀ Wstecz