get_sample_permalink
Filters the sample permalink.
Usage
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)
Array containing the sample permalink with placeholder for the post name, and the post name.
-
0(string)
The permalink with placeholder for the post name. - 1(string)
The post name.
-
- $post_id(int)
- Post ID.
- $title(string)
- Post title.
- $name(string)
- Post name (slug).
- $post(WP_Post)
- Post object.
Changelog
Since 4.4.0 | Introduced. |
Where the hook is called
get_sample_permalink
wp-admin/includes/post.php 1505
return apply_filters( 'get_sample_permalink', $permalink, $post->ID, $title, $name, $post );