Title: previous_comments_link_attributes
Published: April 25, 2014
Last modified: August 20, 2026

---

# apply_filters( ‘previous_comments_link_attributes’, string $attributes )

## In this article

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

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

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

 `$attributes`string

Attributes for the anchor tag.

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

    ```php
    $attr = apply_filters( 'previous_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/7.1/src/wp-includes/link-template.php#L3227)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/link-template.php#L3227-L3227)

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

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

Retrieves the link to the previous comments page.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/hooks/previous_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/previous_comments_link_attributes/?output_format=md#user-contributed-notes)󠁿

 1.  [Skip to note 2 content](https://developer.wordpress.org/reference/hooks/previous_comments_link_attributes/?output_format=md#comment-content-6550)
 2.   [Razon Komar Pal](https://profiles.wordpress.org/raazon/)  [  3 years ago  ](https://developer.wordpress.org/reference/hooks/previous_comments_link_attributes/#comment-6550)
 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%2Fprevious_comments_link_attributes%2F%23comment-6550)
    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%2Fprevious_comments_link_attributes%2F%23comment-6550)
 4. To add class in `previous link` tag:
 5.     ```php
        function wpdocs_comments_link_attributes() {
        	return 'class="your-class-name"';
        }
        add_filter( 'previous_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%2Fprevious_comments_link_attributes%2F%3Freplytocom%3D6550%23feedback-editor-6550)

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