Filter hook 'comment_url'

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

View Source

comment_url

Filter Hook
Description
Filters the comment author's URL for display.

Hook Information

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

Hook Parameters

Type Name Description
string $comment_author_url The comment author's URL.
string $comment_id The comment ID as a numeric string.

Usage Examples

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

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

Source Code Context

wp-includes/comment-template.php:407 - How this hook is used in WordPress core
<?php
 402  	 * @since 4.1.0 The `$comment_id` parameter was added.
 403  	 *
 404  	 * @param string $comment_author_url The comment author's URL.
 405  	 * @param string $comment_id         The comment ID as a numeric string.
 406  	 */
 407  	echo apply_filters( 'comment_url', $comment_author_url, $comment->comment_ID );
 408  }
 409  
 410  /**
 411   * Retrieves the HTML link of the URL of the author of the current comment.
 412   *

PHP Documentation

<?php
/**
	 * Filters the comment author's URL for display.
	 *
	 * @since 1.2.0
	 * @since 4.1.0 The `$comment_id` parameter was added.
	 *
	 * @param string $comment_author_url The comment author's URL.
	 * @param string $comment_id         The comment ID as a numeric string.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/comment-template.php
Related Hooks

Related hooks will be displayed here in future updates.