get_comment_link
Filters the returned single comment permalink.
Использование
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(строка)
- The comment permalink with '#comment-$id' appended.
- $comment(WP_Comment)
- The current comment object.
- $args(массив)
- An array of arguments to override the defaults.
- $cpage(int)
- The calculated 'cpage' value.
Список изменений
| С версии 2.8.0 | Введена. |
| С версии 4.4.0 | Added the $cpage parameter. |
Где вызывается хук
get_comment_link
wp-includes/comment-template.php 862
return apply_filters( 'get_comment_link', $comment_link, $comment, $args, $cpage );