Sunday, 6 October 2013

How To Change WordPress Author URL Slug

Important: All scripts hosted on widcraft.googlecode.com don't work anymore because Google has blocked that SVN repository.

In WordPress, an author's profile is by default accessible by using the yoursite.com/author/name. But it's really easy to change the default author url slug/base. All be just need is a simple snippet.

Kevin Chard found a great code to change the default yoursite.com/author/name to yoursite.com/profile/name. Just add following snippet to your functions.php file:

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

Replace profile on line 4 by any slug you want.
Important: Check our new website TricksPanda.com for WordPress tutorials, plugins and more.
 
Powered by Blogger.