Filter hook '{$adjacent}_post_rel_link'

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

View Source

{$adjacent}_post_rel_link

Filter Hook
Description
Filters the adjacent post relational link. The dynamic portion of the hook name, `$adjacent`, refers to the type of adjacency, 'next' or 'previous'. Possible hook names include: - `next_post_rel_link` - `previous_post_rel_link`

Hook Information

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

Hook Parameters

Type Name Description
string $link The relational link.

Usage Examples

Basic Usage
<?php
// Hook into {$adjacent}_post_rel_link
add_filter('{$adjacent}_post_rel_link', 'my_custom_filter', 10, 1);

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

Source Code Context

wp-includes/link-template.php:2102 - How this hook is used in WordPress core
<?php
2097  	 *
2098  	 * @since 2.8.0
2099  	 *
2100  	 * @param string $link The relational link.
2101  	 */
2102  	return apply_filters( "{$adjacent}_post_rel_link", $link );
2103  }
2104  
2105  /**
2106   * Displays the relational links for the posts adjacent to the current post.
2107   *

PHP Documentation

<?php
/**
	 * Filters the adjacent post relational link.
	 *
	 * The dynamic portion of the hook name, `$adjacent`, refers to the type
	 * of adjacency, 'next' or 'previous'.
	 *
	 * Possible hook names include:
	 *
	 *  - `next_post_rel_link`
	 *  - `previous_post_rel_link`
	 *
	 * @since 2.8.0
	 *
	 * @param string $link The relational link.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 1
  • File: wp-includes/link-template.php
Related Hooks

Related hooks will be displayed here in future updates.