I've successfully removed my author slug using this tutorial: https://wp-snippet.com/snippets/remove-author-prefix-from-slug/

so it's like website.com/author/cixxy to website.com/cixxy

My question is, if I have an existing page like website.com/readme , and a new user registers as readme nickname, then his author page will just redirect to the readme page.

Or if they registered already, then I won't be able to use that nickname for a page anymore, right? So if they registered as "Contact" username, I won't be able to have a /contact slug.

How can I prevent this? I see behance.net, facebook etc using both pages as the root and also users, so I'm guessing there has to be a way.

  • 2
    This is why the author/ part of the URL exists. Do you really need to remove it? – Jacob Peattie Sep 12 at 9:52
  • Well for user sharing their links, it's much better. The site is a portfolio sharing site so it's bad to do website.com/u/user ... looks much better as website.com/user but I need to get around this issue like facebook , behance , etc did. – Cixxy Sep 12 at 10:01
  • Then you have to indicate that this is page, not author: example.com/page/cixxy (like Behance do). Anyway, this is useless endeavour. – Max Yudin Sep 12 at 10:07
  • @MaxYudin no, behance keeps them all under the root page. And it's not useless like I just pointed out, there's a reason why all the big social media sites do this. – Cixxy Sep 12 at 11:30
up vote 1 down vote accepted

There is no way around uniqueness being necessary, with the effects you described. Personally I wouldn't remove the part that makes ensuring uniqueness of the slug much easier, like the author part, in my mind it is just a sign of a well structured site. Anyhow, there is validate_username() function with the validate_username hook. You can use it to disallow certain usernames, so e.g. a custom list of stopwords you want to enforce. And you can use it to prevent the registration of usernames, who would be conflicting with other already registered slugs, content.

  • Thank you. So basically use plugin like this to stop certain usernames from being registered: wordpress.org/plugins/restrict-usernames I guess I'll need a list of pages i'll potentially create in the future as well as existing ones. – Cixxy Sep 12 at 12:28
  • I don't know the plugin, but it looks like it's going in the right direction, and might be (at least partially) suitable. @Cixxy – Nicolai Sep 12 at 12:37

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.