Filter hook 'page_link'

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

View Source

page_link

Filter Hook
Description
Filters the permalink for a page.

Hook Information

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

Hook Parameters

Type Name Description
string $link The page's permalink.
int $post_id The ID of the page.
bool $sample Is it a sample permalink.

Usage Examples

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

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

Source Code Context

wp-includes/link-template.php:409 - How this hook is used in WordPress core
<?php
 404  	 *
 405  	 * @param string $link    The page's permalink.
 406  	 * @param int    $post_id The ID of the page.
 407  	 * @param bool   $sample  Is it a sample permalink.
 408  	 */
 409  	return apply_filters( 'page_link', $link, $post->ID, $sample );
 410  }
 411  
 412  /**
 413   * Retrieves the page permalink.
 414   *

PHP Documentation

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

Related hooks will be displayed here in future updates.