Removing The Author-Base In Wordpress

If you have open registrations for your Wordpress site and make use of the profile page tags, to make nice profile pages for your authors, you may want to remove a small annoyance.

Wordpress Author Admin

If you have open registrations for your Wordpress site and make use of the profile page tags, to make nice profile pages for your authors, you may want to remove a small annoyance.

By default, after you choose Pretty Permalinks for your posts, Wordpress will create URLs for your author pages like this:

http://crrrg.com/author/craig

But say you want something a little cooler, like Twitter.com profiles. You want to remove the ‘author’ bit from the URL.

Now, you can’t do this from the Wordpress admin; you must do a little .php editing. Don’t worry, it’s very basic. It’s all in the rewrite.php file.

The rewrite.php file is located in your Wordpress wp-includes folder.

Base

The first section you want to get to is the bit beginning with:

class WP_Rewrite {

Here you’ll find this:

var $author_base = 'author';

Look familiar? This is where that part of the URL comes from. Remove this and leave the quotations.

Is that it? Actually, no. There is one little problem with a remaining forward slash. Although it won’t affect the link and still forward to the author page, it does look a little silly:

http://crrrg.com//craig

Removing The Second Slash

This is just as easy as the first bit. Go further down the rewrite.php file where it is defining all the permalink restructures for the other URLs such as tags and the Wordpress feed. Here you’ll come across this:

function get_author_permastruct() {

This is the section you’re looking for.

A little further down is this line:

$this->author_structure = $this->front . $this->author_base . '/%author%';

Do you see what’s wrong here? There’s that little extra forward slash. Now just delete that, and we’re all done!

Quickly

var $author_base = 'author';

becomes

var $author_base = '';

and

$this->author_structure = $this->front . $this->author_base . '/%author%';

becomes

$this->author_structure = $this->front . $this->author_base . '%author%';

Save and re-upload to the wp-includes folder. yay!!

Tags: ,

This entry was posted on Thursday, January 31st, 2008 at 5:55 am and is filed under Long. You can follow any responses to this entry through the RSS 2.0 feed. You can skip to the end and leave a response. Pinging is currently not allowed.

ss_blog_claim=53530d43dc267adc556cf944bc3e7d55