get_sample_permalink
Filters the sample permalink.
Использование
add_filter( 'get_sample_permalink', 'wp_kama_get_sample_permalink_filter', 10, 5 );
/**
* Function for `get_sample_permalink` filter-hook.
*
* @param array $permalink Array containing the sample permalink with placeholder for the post name, and the post name.
* @param int $post_id Post ID.
* @param string $title Post title.
* @param string $name Post name (slug).
* @param WP_Post $post Post object.
*
* @return array
*/
function wp_kama_get_sample_permalink_filter( $permalink, $post_id, $title, $name, $post ){
// filter...
return $permalink;
}
- $permalink(массив)
Array containing the sample permalink with placeholder for the post name, and the post name.
-
0(строка)
The permalink with placeholder for the post name. - 1(строка)
The post name.
-
- $post_id(int)
- Post ID.
- $title(строка)
- Post title.
- $name(строка)
- Post name (slug).
- $post(WP_Post)
- Post object.
Список изменений
| С версии 4.4.0 | Введена. |
Где вызывается хук
get_sample_permalink
wp-admin/includes/post.php 1546
return apply_filters( 'get_sample_permalink', $permalink, $post->ID, $title, $name, $post );