get_sample_permalink WordPress Filter Hook
The get_sample_permalink hook is fired when a sample permalink is generated. It allows for the modification of the generated permalink before it is returned. This hook is useful for custom post types that need to have a different permalink structure than the default. By hooking into this hook, you can change the generated permalink to match your custom post type's permalink structure.
apply_filters( 'get_sample_permalink', array $permalink , int $post_id , string $title , string $name , WP_Post $post ) #
Filters the sample permalink.
Parameters
- $permalink
(array)Array containing the sample permalink with placeholder for the post name, and the post name.
- (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.
Source
Changelog
Version | Description |
---|---|
4.4.0 | Introduced. |