get_parent_post_rel_link

The timeline below displays how wordpress function get_parent_post_rel_link has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.5

/**
 * Get parent post relational link.
 *
 * @since 2.8.0
 * @deprecated 3.3.0
 *
 * @global WP_Post $post Global post object.
 *
 * @param string $title Optional. Link title format. Default '%title'.
 * @return string
 */
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);
}

WordPress Version: 4.6

/**
 * Get parent post relational link.
 *
 * @since 2.8.0
 * @deprecated 3.3.0
 *
 * @param string $title Optional. Link title format. Default '%title'.
 * @return string
 */
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);
}

WordPress Version: 4.5

/**
 * Get parent post relational link.
 *
 * @since 2.8.0
 * @deprecated 3.3.0
 *
 * @param string $title Optional. Link title format. Default '%title'.
 * @return string
 */
function get_parent_post_rel_link($title = '%title')
{
    _deprecated_function(__FUNCTION__, '3.3');
    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);
}

WordPress Version: 3.7

/**
 * Get parent post relational link.
 *
 * @since 2.8.0
 * @deprecated 3.3.0
 *
 * @param string $title Optional. Link title format.
 * @return string
 */
function get_parent_post_rel_link($title = '%title')
{
    _deprecated_function(__FUNCTION__, '3.3');
    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);
}