previous_post_link
Filters the adjacent post link.
Это один из вариантов динамического хука (adjacent)_post_link
Использование
add_filter( 'previous_post_link', 'wp_kama_previous_post_link_filter', 10, 5 );
/**
* Function for `previous_post_link` filter-hook.
*
* @param string $output The adjacent post link.
* @param string $format Link anchor format.
* @param string $link Link permalink format.
* @param WP_Post|string $post The adjacent post. Empty string if no corresponding post exists.
* @param string $adjacent Whether the post is previous or next.
*
* @return string
*/
function wp_kama_previous_post_link_filter( $output, $format, $link, $post, $adjacent ){
// filter...
return $output;
}
- $output(строка)
- The adjacent post link.
- $format(строка)
- Link anchor format.
- $link(строка)
- Link permalink format.
- $post(WP_Post|строка)
- The adjacent post. Empty string if no corresponding post exists.
- $adjacent(строка)
- Whether the post is previous or next.
Список изменений
| С версии 2.6.0 | Введена. |
| С версии 4.2.0 | Added the $adjacent parameter. |
Где вызывается хук
wp-includes/link-template.php 2396
return apply_filters( "{$adjacent}_post_link", $output, $format, $link, $post, $adjacent );