post_type_link filter-hookWP 3.0.0

Filters the permalink for a post of a custom post type.

Usage

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(string)
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.

Changelog

Since 3.0.0 Introduced.

Where the hook is called

get_post_permalink()
post_type_link
wp-includes/link-template.php 370
return apply_filters( 'post_type_link', $post_link, $post, $leavename, $sample );

Where the hook is used in WordPress

Usage not found.