get_comment_link
Filters the returned single comment permalink.
Usage
add_filter( 'get_comment_link', 'wp_kama_get_comment_link_filter', 10, 4 ); /** * Function for `get_comment_link` filter-hook. * * @param string $comment_link The comment permalink with '#comment-$id' appended. * @param WP_Comment $comment The current comment object. * @param array $args An array of arguments to override the defaults. * @param int $cpage The calculated 'cpage' value. * * @return string */ function wp_kama_get_comment_link_filter( $comment_link, $comment, $args, $cpage ){ // filter... return $comment_link; }
- $comment_link(string)
- The comment permalink with '#comment-$id' appended.
- $comment(WP_Comment)
- The current comment object.
- $args(array)
- An array of arguments to override the defaults.
- $cpage(int)
- The calculated 'cpage' value.
Changelog
Since 2.8.0 | Introduced. |
Since 4.4.0 | Added the $cpage parameter. |
Where the hook is called
get_comment_link
wp-includes/comment-template.php 854
return apply_filters( 'get_comment_link', $comment_link, $comment, $args, $cpage );