Warning: This function has been deprecated.

get_parent_post_rel_link() WordPress Function

The get_parent_post_rel_link() function can be used to get the URL of the parent page for a given post. This is useful for creating a breadcrumb trail for the post, or for linking back to the parent page from the post.

get_parent_post_rel_link( string $title = '%title' ) #

Get parent post relational link.


Parameters

$title

(string)(Optional) Link title format.

Default value: '%title'


Top ↑

Return

(string)


Top ↑

Source

File: wp-includes/deprecated.php

function get_parent_post_rel_link( $title = '%title' ) {
	_deprecated_function( __FUNCTION__, '3.3.0' );

	if ( ! empty( $GLOBALS['post'] ) && ! empty( $GLOBALS['post']->post_parent ) )
		$post = get_post($GLOBALS['post']->post_parent);

	if ( empty($post) )
		return;

	$date = mysql2date(get_option('date_format'), $post->post_date);

	$title = str_replace('%title', $post->post_title, $title);
	$title = str_replace('%date', $date, $title);
	$title = apply_filters('the_title', $title, $post->ID);

	$link = "<link rel='up' title='";
	$link .= esc_attr( $title );
	$link .= "' href='" . get_permalink($post) . "' />\n";

	return apply_filters( "parent_post_rel_link", $link );
}


Top ↑

Changelog

Changelog
VersionDescription
3.3.0This function has been deprecated.
2.8.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More