Filter Author Link for Numerous Authors for each to go to unique page

I was looking here:

Change destination author link

But there doesn't seem to be a suggestion on how to work with multiple authors (not co-authors, but each author publishing their own stories.

This is the main portion of the Link class in a plugin I'm working on. This simply turns every author link to the same link. The code is fine for a single author blog.

Am I not using author_link appropriately? Because adding dump(var) actually lists the author ID 3 times in a single post - with the first dump being null.

public function hook() {
    add_filter( 'author_link', array( $this, 'xenword_author_link' ), 10, 1 );
}

/**
 * @return mixed|string
 */
public function xenword_author_link($link, $author_id, $author_nicename) {

    if ( ! class_exists( '\XF' ) ) {
        return false;
    }

    // $author_id = get_the_author_meta('ID');

    if ($author_id == '') {
        return false;
    }

    if ($link == '') {
        return false;
    }

    $xf_author = XF::app()-finder('XF:User')-where('user_id', $author_id )-fetchOne();

    $link = XF::app()-router('public')-buildLink( 'canonical:members/#recent-content', $xf_author );

}

Topic author Wordpress

Category Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.