Filter hook '_get_page_link'

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

View Source

_get_page_link

Filter Hook
Description
Filters the permalink for a non-page_on_front page.

Hook Information

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

Hook Parameters

Type Name Description
string $link The page's permalink.
int $post_id The ID of the page.

Usage Examples

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

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

Source Code Context

wp-includes/link-template.php:456 - How this hook is used in WordPress core
<?php
 451  	 * @since 2.1.0
 452  	 *
 453  	 * @param string $link    The page's permalink.
 454  	 * @param int    $post_id The ID of the page.
 455  	 */
 456  	return apply_filters( '_get_page_link', $link, $post->ID );
 457  }
 458  
 459  /**
 460   * Retrieves the permalink for an attachment.
 461   *

PHP Documentation

<?php
/**
	 * Filters the permalink for a non-page_on_front page.
	 *
	 * @since 2.1.0
	 *
	 * @param string $link    The page's permalink.
	 * @param int    $post_id The ID of the page.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/link-template.php
Related Hooks

Related hooks will be displayed here in future updates.