$post->post_name =
sanitize_title( $post->post_name ?
$post->post_name :
$post->post_title,
$post->ID
);
} /*
* If the user wants to set a new name -- override the current one.
* Note: if empty name is supplied -- use the title instead, see #6072.
*/
if ( !
is_null( $name ) ) { $post->post_name =
sanitize_title( $name ?
$name :
$title,
$post->ID
);
} $post->post_name =
wp_unique_post_slug( $post->post_name,
$post->ID,
$post->post_status,
$post->post_type,
$post->post_parent
);
$post->filter = 'sample';
$permalink =
get_permalink( $post, true
);
// Replace custom post_type token with generic pagename token for ease of use.
$permalink =
str_replace( "%
$post->post_type%", '%pagename%',
$permalink );
// Handle page hierarchy.
if ( $ptype->hierarchical
) { $uri =
get_page_uri( $post );