views:

380

answers:

3

There are 3 authors in our company blog, each author has own site url in profile settings:

Mike - http://mike.com
Gelens - http://gelens.com
Admin - http://site.com/company/

the links for profiles are:

http://site.com/author/Mike/
http://site.com/author/Gelens/
http://site.com/author/Admin/

I need to replace a link to Admin's page, so, if there is <?php the_author_posts_link(); ?> tag on some page, and the author is Admin, the link must be http://site.com/company/ instead of http://site.com/author/Admin/.

How can I do that?

A: 

You can do this using http rewrites.

windyjonas
+1  A: 

That's URL rewriting with .htaccess, which is possible by editing the .htaccess by hand.

But easier for a beginner with a plugin such as http://wordpress.org/extend/plugins/redirection/ which seems like it will do what you need.

songdogtech
+1  A: 

It looks like the the_author_posts_link function just calls get_author_posts_url to get the link, which passes the link through the author_link filter before returning it. In your theme's functions.php, you could add something like this (untested):

add_filter( 'author_link', 'admin_author_link', 10, 3);
function admin_author_link($link, $author_id, $author_nicename) {
    if( $author_id==1 ) {
        $link = 'http://site.com/company/';
    }
    return $link;
}
scompt.com