get_sample_permalink

Filters the sample permalink.

Description

apply_filters( 'get_sample_permalink', (array) $permalink, (int) $post_id, (string) $title, (string) $name, (WP_Post) $post ); 

Parameters (5)

0. $permalink (array)
Array containing the sample permalink with placeholder for the post name, and the post name.
1. $post_id (int)
The post id.
2. $title (string)
Post title.
3. $name (string)
Post name (slug).
4. $post (WP_Post)
Post object.

Usage

To run the hook, copy the example below.
  1. $permalink = apply_filters( 'get_sample_permalink', $permalink, $post_id, $title, $name, $post ); 
  2.  
  3. if ( !empty( $permalink ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the get_sample_permalink callback 
  2. function filter_get_sample_permalink( $permalink, $post_id, $title, $name, $post ) { 
  3. // make filter magic happen here... 
  4. return $permalink
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'get_sample_permalink', 'filter_get_sample_permalink', 10, 5 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'get_sample_permalink', 'filter_get_sample_permalink', 10, 5 ); 

Defined (1)

The filter is defined in the following location(s).

/wp-admin/includes/post.php  
  1. return apply_filters( 'get_sample_permalink', $permalink, $post->ID, $title, $name, $post );