get_page_of_comment хук-фильтрWP 4.4.0

Filters the calculated page on which a comment appears.

Использование

add_filter( 'get_page_of_comment', 'wp_kama_get_page_of_comment_filter', 10, 4 );

/**
 * Function for `get_page_of_comment` filter-hook.
 * 
 * @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`.
 * @param array $original_args Array of arguments passed to the function. Some or all of these may not be set.
 * @param int   $comment_id    ID of the comment.
 *
 * @return int
 */
function wp_kama_get_page_of_comment_filter( $page, $args, $original_args, $comment_id ){

	// filter...
	return $page;
}
$page(int)
Comment page.
$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(строка)
    Type of comments to count.

  • page(int)
    Calculated current page.

  • per_page(int)
    Calculated number of comments per page.

  • max_depth(int)
    Maximum comment threading depth allowed.
$original_args(массив)

Array of arguments passed to the function. Some or all of these may not be set.

  • type(строка)
    Type of comments to count.

  • page(int)
    Current comment page.

  • per_page(int)
    Number of comments per page.

  • max_depth(int)
    Maximum comment threading depth allowed.
$comment_id(int)
ID of the comment.

Список изменений

С версии 4.4.0 Введена.
С версии 4.7.0 Introduced the $comment_id parameter.

Где вызывается хук

get_page_of_comment()
get_page_of_comment
wp-includes/comment.php 1204
return apply_filters( 'get_page_of_comment', (int) $page, $args, $original_args, $comment_id );

Где используется хук в WordPress

Использование не найдено.