Title: next_comments_link_attributes
Published: April 25, 2014
Last modified: February 24, 2026

---

# apply_filters( ‘next_comments_link_attributes’, string $attributes )

## In this article

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

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

Filters the anchor tag attributes for the next comments page link.

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

 `$attributes`string

Attributes for the anchor tag.

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

    ```php
    $attr = apply_filters( 'next_comments_link_attributes', '' );
    ```

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

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

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

Retrieves the link to the next comments page.

  |

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

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

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

 1.  [Skip to note 2 content](https://developer.wordpress.org/reference/hooks/next_comments_link_attributes/?output_format=md#comment-content-6549)
 2.   [Razon Komar Pal](https://profiles.wordpress.org/raazon/)  [  3 years ago  ](https://developer.wordpress.org/reference/hooks/next_comments_link_attributes/#comment-6549)
 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%2Fnext_comments_link_attributes%2F%23comment-6549)
    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%2Fnext_comments_link_attributes%2F%23comment-6549)
 4. To add class in `next link` tag:
 5.     ```php
        function wpdocs_comments_link_attributes() {
        	return 'class="your-class-name"';
        }
        add_filter( 'next_comments_link_attributes', 'wpdocs_comments_link_attributes' );
        ```
    
 6.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fnext_comments_link_attributes%2F%3Freplytocom%3D6549%23feedback-editor-6549)

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