post_type_link
Filters the permalink for a post of a custom post type.
Использование
add_filter( 'post_type_link', 'wp_kama_post_type_link_filter', 10, 4 ); /** * Function for `post_type_link` filter-hook. * * @param string $post_link The post's permalink. * @param WP_Post $post The post in question. * @param bool $leavename Whether to keep the post name. * @param bool $sample Is it a sample permalink. * * @return string */ function wp_kama_post_type_link_filter( $post_link, $post, $leavename, $sample ){ // filter... return $post_link; }
- $post_link(строка)
- The post's permalink.
- $post(WP_Post)
- The post in question.
- $leavename(true|false)
- Whether to keep the post name.
- $sample(true|false)
- Is it a sample permalink.
Список изменений
С версии 3.0.0 | Введена. |
Где вызывается хук
post_type_link
wp-includes/link-template.php 375
return apply_filters( 'post_type_link', $post_link, $post, $leavename, $sample );