Filter hook 'post_comments_link'

in WP Core File wp-includes/comment-template.php at line 1968

View Source

post_comments_link

Filter Hook
Description
Filters the formatted post comments link HTML.

Hook Information

File Location wp-includes/comment-template.php View on GitHub
Hook Type Filter
Line Number 1968

Hook Parameters

Type Name Description
string $post_reply_link The HTML-formatted post comments link.
int|WP_Post $post The post ID or WP_Post object.

Usage Examples

Basic Usage
<?php
// Hook into post_comments_link
add_filter('post_comments_link', 'my_custom_filter', 10, 2);

function my_custom_filter($post_reply_link, $post) {
    // Your custom filtering logic here
    return $post_reply_link;
}

Source Code Context

wp-includes/comment-template.php:1968 - How this hook is used in WordPress core
<?php
1963  	 * @since 2.7.0
1964  	 *
1965  	 * @param string      $post_reply_link The HTML-formatted post comments link.
1966  	 * @param int|WP_Post $post            The post ID or WP_Post object.
1967  	 */
1968  	return apply_filters( 'post_comments_link', $post_reply_link, $post );
1969  }
1970  
1971  /**
1972   * Displays the HTML content for reply to post link.
1973   *

PHP Documentation

<?php
/**
	 * Filters the formatted post comments link HTML.
	 *
	 * @since 2.7.0
	 *
	 * @param string      $post_reply_link The HTML-formatted post comments link.
	 * @param int|WP_Post $post            The post ID or WP_Post object.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/comment-template.php
Related Hooks

Related hooks will be displayed here in future updates.