get_comments_link
Filters the returned post comments permalink.
Usage
add_filter( 'get_comments_link', 'wp_kama_get_comments_link_filter', 10, 2 );
/**
* Function for `get_comments_link` filter-hook.
*
* @param string $comments_link Post comments permalink with '#comments' appended.
* @param int|WP_Post $post Post ID or WP_Post object.
*
* @return string
*/
function wp_kama_get_comments_link_filter( $comments_link, $post ){
// filter...
return $comments_link;
}
- $comments_link(string)
- Post comments permalink with '#comments' appended.
- $post(int|WP_Post)
- Post ID or WP_Post object.
Changelog
| Since 3.6.0 | Introduced. |
Where the hook is called
get_comments_link
wp-includes/comment-template.php 885
return apply_filters( 'get_comments_link', $comments_link, $post );