title: Replace Blog Post Author link with Team Member link (CPT + ACF)
body: <p>I'm building a website that has &quot;Team Members&quot; section and &quot;Blog&quot; section. Team members are a custom post type.</p>
  <p>The client requested that the links to authors in blog posts should point to associated Team Member page instead of the default author page in WordPress (basically they don't want to have default author pages at all).</p>
  <p>I've found this solution offered by @Damocles - <a href="https://stackoverflow.com/questions/59783558/use-team-members-custom-post-type-instead-of-author-for-blog-posts">Use &quot;Team Members&quot; custom post type instead of Author for blog posts</a></p>
  <p>Basically the solution proposed by him was simple and exactly as I thought initially of tackling this issue:</p>
  <ol>
  <li>Create a &quot;Post Object&quot; ACF field and set it to filter through &quot;Team Member&quot; custom post types</li>
  <li>Attach this field to User accounts</li>
  <li>Go to user profile and choose the correct Team Member from drop down menu</li>
  <li>Then use a filter in functions.php to automatically replace the author link everywhere with associated Team Member url</li>
  </ol>
  <p>Makes sense but unfortunately, it doesn't want to work on my website. I even used the same name for ACF field as he did and used the exact same code in functions.php:</p>
  <pre><code>add_filter( 'author_link', 'team_author_link', 10, 3 );
  function team_author_link( $link, $author_id, $author_nicename ) {
  
    $team_post_id = get_field('team_post', $author_id);
    // if the team post is set, get the permalink to the team post:
    $team_link = get_permalink($team_post_id);
    $link = ($team_link !== false) ? $team_link : $link;
    return $link;
  }
  </code></pre>
  <p>The author link DOES change, BUT instead of pointing to the associated Team Member page, all author links point to the currently opened blog post URL. I don't know, maybe my theme is overwriting the query or something, so the URL to the custom post type cannot be achieved from blog post view?</p>
  <p>Can someone help me achieve it, please? I want to attach a Team Member (custom post type) to user account in WordPress and replace the author link through functions.php to the associated Team Member page url.</p>