Advertisements

get_page_link

Definition:
function get_page_link( $id = false, $leavename = false, $sample = false ) {}

Retrieve the permalink for current page or page ID.
Respects page_on_front. Use this one.

Parameters

  • int $id: Optional. Post ID.
  • bool $leavename: Optional, defaults to false. Whether to keep page name.
  • bool $sample: Optional, defaults to false. Is it a sample permalink.

Defined filters

  • page_link
    apply_filters('page_link', $link, $id, $sample)

Source code

function get_page_link( $id = false, $leavename = false, $sample = false ) {

	global $post;



	$id = (int) $id;

	if ( !$id )

		$id = (int) $post->ID;



	if ( 'page' == get_option('show_on_front') && $id == get_option('page_on_front') )

		$link = home_url('/');

	else

		$link = _get_page_link( $id , $leavename, $sample );



	return apply_filters('page_link', $link, $id, $sample);

}

1538

Advertisements

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: