2

I'm trying to figure out the best way to remove /author/ from the profile URL of my users. I tried using the method in the link below and although it worked, it also prevented me from accessing any of my other pages that used a page template. So not sure if there's a tweak I need to make to the code?

I would like to do this through the functions file and not use a plugin so any guidance is much appreciated.

add_action('init', 'cng_author_base');
function cng_author_base() {
   global $wp_rewrite;
   $author_slug = ''; // change slug name
   $wp_rewrite->author_base = $author_slug;
}
2

Essentially, you can't do that because you've overlapped the "page" and "author" sections in the namespace.

See, with your setup, then given a URL like http://example.com/whatever, WordPress has no way to distinguish whether "whatever" is an author or a Page.

To do this, you'd need to add a lot more code to add extra querying during the rewrite parsing, basically. Which means that you should use a plugin to do it, if you still want to do it at all.

  • Dang, ok, do you know of a solid plugin that can do this in a multisite instance? – Jake Lisby Aug 13 '13 at 20:34
  • No, I don't know of any existing plugin to do this. That's not to say one isn't out there, I just don't know of one. It's not something that comes up a lot. – Otto Aug 13 '13 at 20:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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