Filter hook 'get_page_of_comment'

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

View Source

get_page_of_comment

Filter Hook
Description
Filters the calculated page on which a comment appears. } }

Hook Information

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

Hook Parameters

Type Name Description
int $page Comment page.
array $args { Arguments used to calculate pagination. These include arguments auto-detected by the function, based on query vars, system settings, etc. For pristine arguments passed to the function, see `$original_args`.
array $original_args { Array of arguments passed to the function. Some or all of these may not be set.
int $comment_id ID of the comment.

Usage Examples

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

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

Source Code Context

wp-includes/comment.php:1185 - How this hook is used in WordPress core
<?php
1180  	 *     @type int    $per_page  Number of comments per page.
1181  	 *     @type int    $max_depth Maximum comment threading depth allowed.
1182  	 * }
1183  	 * @param int $comment_id ID of the comment.
1184  	 */
1185  	return apply_filters( 'get_page_of_comment', (int) $page, $args, $original_args, $comment_id );
1186  }
1187  
1188  /**
1189   * Retrieves the maximum character lengths for the comment form fields.
1190   *

PHP Documentation

<?php
/**
	 * Filters the calculated page on which a comment appears.
	 *
	 * @since 4.4.0
	 * @since 4.7.0 Introduced the `$comment_id` parameter.
	 *
	 * @param int   $page          Comment page.
	 * @param array $args {
	 *     Arguments used to calculate pagination. These include arguments auto-detected by the function,
	 *     based on query vars, system settings, etc. For pristine arguments passed to the function,
	 *     see `$original_args`.
	 *
	 *     @type string $type      Type of comments to count.
	 *     @type int    $page      Calculated current page.
	 *     @type int    $per_page  Calculated number of comments per page.
	 *     @type int    $max_depth Maximum comment threading depth allowed.
	 * }
	 * @param array $original_args {
	 *     Array of arguments passed to the function. Some or all of these may not be set.
	 *
	 *     @type string $type      Type of comments to count.
	 *     @type int    $page      Current comment page.
	 *     @type int    $per_page  Number of comments per page.
	 *     @type int    $max_depth Maximum comment threading depth allowed.
	 * }
	 * @param int $comment_id ID of the comment.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 4
  • File: wp-includes/comment.php
Related Hooks

Related hooks will be displayed here in future updates.