pre_post_link filter-hookWP 3.0.0

Filters the permalink structure for a post before token replacement occurs.

Only applies to posts with post_type of 'post'.

Usage

add_filter( 'pre_post_link', 'wp_kama_pre_post_link_filter', 10, 3 );

/**
 * Function for `pre_post_link` filter-hook.
 * 
 * @param string  $permalink The site's permalink structure.
 * @param WP_Post $post      The post in question.
 * @param bool    $leavename Whether to keep the post name.
 *
 * @return string
 */
function wp_kama_pre_post_link_filter( $permalink, $post, $leavename ){

	// filter...
	return $permalink;
}
$permalink(string)
The site's permalink structure.
$post(WP_Post)
The post in question.
$leavename(true|false)
Whether to keep the post name.

Changelog

Since 3.0.0 Introduced.

Where the hook is called

get_permalink()
pre_post_link
wp-includes/link-template.php 217
$permalink = apply_filters( 'pre_post_link', $permalink, $post, $leavename );

Where the hook is used in WordPress

Usage not found.