Filter hook 'get_pagenum_link'

in WP Core File wp-includes/link-template.php at line 2490

View Source

get_pagenum_link

Filter Hook
Description
Filters the page number link for the current request.

Hook Information

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

Hook Parameters

Type Name Description
string $result The page number link.
int $pagenum The page number.

Usage Examples

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

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

Source Code Context

wp-includes/link-template.php:2490 - How this hook is used in WordPress core
<?php
2485  	 * @since 5.2.0 Added the `$pagenum` argument.
2486  	 *
2487  	 * @param string $result  The page number link.
2488  	 * @param int    $pagenum The page number.
2489  	 */
2490  	$result = apply_filters( 'get_pagenum_link', $result, $pagenum );
2491  
2492  	if ( $escape ) {
2493  		return esc_url( $result );
2494  	} else {
2495  		return sanitize_url( $result );

PHP Documentation

<?php
/**
	 * Filters the page number link for the current request.
	 *
	 * @since 2.5.0
	 * @since 5.2.0 Added the `$pagenum` argument.
	 *
	 * @param string $result  The page number link.
	 * @param int    $pagenum The page number.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/link-template.php
Related Hooks

Related hooks will be displayed here in future updates.