the_permalink
Filters the display of the permalink for the current post.
Использование
add_filter( 'the_permalink', 'wp_kama_the_permalink_filter', 10, 2 );
/**
* Function for `the_permalink` filter-hook.
*
* @param string $permalink The permalink for the current post.
* @param int|WP_Post $post Post ID, WP_Post object, or 0.
*
* @return string
*/
function wp_kama_the_permalink_filter( $permalink, $post ){
// filter...
return $permalink;
}
- $permalink(строка)
- The permalink for the current post.
- $post(int|WP_Post)
- Post ID, WP_Post object, or 0.
Список изменений
| С версии 1.5.0 | Введена. |
| С версии 4.4.0 | Added the $post parameter. |
Где вызывается хук
the_permalink
the_permalink
wp-includes/link-template.php 27
echo esc_url( apply_filters( 'the_permalink', get_permalink( $post ), $post ) );
wp-includes/comment-template.php 2624
wp_login_url( apply_filters( 'the_permalink', get_permalink( $post_id ), $post_id ) )
wp-includes/comment-template.php 2635
wp_logout_url( apply_filters( 'the_permalink', get_permalink( $post_id ), $post_id ) )