W3cubDocs

/WordPress

get_the_permalink( int|WP_Post $post, bool $leavename = false ): string|false

Retrieves the full permalink for the current post or post ID.

Description

This function is an alias for get_permalink() .

See also

Parameters

$postint|WP_Postoptional
Post ID or post object. Default is the global $post.
$leavenamebooloptional
Whether to keep post name or page name.

Default:false

Return

string|false The permalink URL. False if the post does not exist.

Source

function get_the_permalink( $post = 0, $leavename = false ) {
	return get_permalink( $post, $leavename );
}

Changelog

Version Description
3.9.0 Introduced.

© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/get_the_permalink