get_parent_post_rel_link

函数
get_parent_post_rel_link ( $title = '%title' )
参数
  • (string) $title Optional. Link title format. Default '%title'.
    Required:
    Default: '%title'
返回值
  • (string)
定义位置
相关方法
parent_post_rel_linkget_adjacent_post_rel_linkstart_post_rel_linkprev_post_rel_linkget_boundary_post_rel_link
引入
2.8.0
弃用
3.3.0

get_parent_post_rel_link函数是一个WordPress函数,用于检索一个文章的父文章的URL: 这个函数不接受任何参数: 该函数返回父帖的URL。

获取父级文章关系链接。

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 );
}

常见问题

FAQs
查看更多 >
闪电侠

(工作日 10:00 - 18:30 为您服务)

2025-12-06 05:33:10

您好,无论是售前、售后、意见建议……均可通过联系工单与我们取得联系。

您也可选择聊天工具与我们即时沟通或点击查看:

您的工单我们已经收到,我们将会尽快跟您联系!
取消
选择聊天工具: