Title: author_link
Published: April 25, 2014
Last modified: May 20, 2026

---

# apply_filters( ‘author_link’, string $link, int $author_id, string $author_nicename )

## In this article

 * [Parameters](https://developer.wordpress.org/reference/hooks/author_link/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/hooks/author_link/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/author_link/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/author_link/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/hooks/author_link/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/hooks/author_link/?output_format=md#wp--skip-link--target)

Filters the URL to the author’s page.

## 󠀁[Parameters](https://developer.wordpress.org/reference/hooks/author_link/?output_format=md#parameters)󠁿

 `$link`string

The URL to the author’s page.

`$author_id`int

The author’s ID.

`$author_nicename`string

The author’s nice name.

## 󠀁[Source](https://developer.wordpress.org/reference/hooks/author_link/?output_format=md#source)󠁿

    ```php
    $link = apply_filters( 'author_link', $link, $author_id, $author_nicename );
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/author-template.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/author-template.php#L413)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/author-template.php#L413-L413)

## 󠀁[Related](https://developer.wordpress.org/reference/hooks/author_link/?output_format=md#related)󠁿

| Used by | Description | 
| [get_author_posts_url()](https://developer.wordpress.org/reference/functions/get_author_posts_url/)`wp-includes/author-template.php` |

Retrieves the URL to the author page for the user with the ID provided.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/hooks/author_link/?output_format=md#changelog)󠁿

| Version | Description | 
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/hooks/author_link/?output_format=md#user-contributed-notes)󠁿

 1.   [Skip to note 3 content](https://developer.wordpress.org/reference/hooks/author_link/?output_format=md#comment-content-4610)
 2.    [Steven Lin](https://profiles.wordpress.org/stevenlinx/)  [  6 years ago  ](https://developer.wordpress.org/reference/hooks/author_link/#comment-4610)
 3.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fauthor_link%2F%23comment-4610)
     Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fauthor_link%2F%23comment-4610)
 4.  Example migrated from Codex:
 5.  If you add the following to the `functions.php` file of your child themes, you
     can modify the author link for all posts or using conditional tags.
 6.      ```php
         add_filter( 'author_link', 'modify_author_link', 10, 1 ); 	 	 
         function modify_author_link( $link ) {	 	 
             $link = 'http://example.com/';
         return $link;
         }
         ```
     
 7.   [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fauthor_link%2F%3Freplytocom%3D4610%23feedback-editor-4610)
 8.   [Skip to note 4 content](https://developer.wordpress.org/reference/hooks/author_link/?output_format=md#comment-content-7122)
 9.    [noruzzaman](https://profiles.wordpress.org/noruzzaman/)  [  2 years ago  ](https://developer.wordpress.org/reference/hooks/author_link/#comment-7122)
 10. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fauthor_link%2F%23comment-7122)
     Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fauthor_link%2F%23comment-7122)
 11. In this tutorial, you will learn how to use the `apply_filters` function with 
     the `author_link` filter to modify the author link based on multiple conditions
     in WordPress. This can be useful if you want to customize the author link for 
     specific authors, roles, or other criteria.
 12. Add the following code to your theme’s `functions.php` file or your custom plugin
     file to hook into the `author_link` filter and modify the author link based on
     multiple conditions.
 13. **Step 1:**
 14.     ```php
         add_filter( 'author_link', 'wpdocs_author_link', 10, 3 );
         ```
     
 15. **Step 2:**
 16.     ```php
         function wpdocs_author_link( $link, $author_id, $author_nicename ) {
             $specific_author_ids = array( 1, 2, 3 ); // Replace with your specific author IDs
             $author = get_user_by( 'ID', $author_id );
     
             // Condition 1: Check for a specific author by ID
             if ( in_array( $author_id, $specific_author_ids ) ) {
                 $link = add_query_arg( 'custom_param', 'value', $link );
             }
     
             // Condition 2: Check if the author has a specific role
             if ( in_array( 'editor', (array) $author->roles ) ) {
                 $link = add_query_arg( 'role', 'editor', $link );
             }
     
             // Condition 3: Modify link for a specific author nicename
             if ( 'john_doe' === $author_nicename ) {
                 $link = home_url( '/special-author-page/' );
             }
     
             // Additional customizations can be added here
     
             return $link;
         }
         ```
     
 17. You have now successfully used the `apply_filters` function with the `author_link`
     filter to modify the author link based on multiple conditions in WordPress. This
     approach allows you to customize the author links to fit your specific requirements.
 18.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fauthor_link%2F%3Freplytocom%3D7122%23feedback-editor-7122)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fauthor_link%2F)
before being able to contribute a note or feedback.