get_boundary_post_rel_link

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

WordPress Version: 5.5

/**
 * Get boundary post relational link.
 *
 * Can either be start or end post relational link.
 *
 * @since 2.8.0
 * @deprecated 3.3.0
 *
 * @param string $title               Optional. Link title format. Default '%title'.
 * @param bool   $in_same_cat         Optional. Whether link should be in a same category.
 *                                    Default false.
 * @param string $excluded_categories Optional. Excluded categories IDs. Default empty.
 * @param bool   $start               Optional. Whether to display link to first or last post.
 *                                    Default true.
 * @return string
 */
function get_boundary_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '', $start = true)
{
    _deprecated_function(__FUNCTION__, '3.3.0');
    $posts = get_boundary_post($in_same_cat, $excluded_categories, $start);
    // If there is no post, stop.
    if (empty($posts)) {
        return;
    }
    // Even though we limited get_posts() to return only 1 item it still returns an array of objects.
    $post = $posts[0];
    if (empty($post->post_title)) {
        $post->post_title = $start ? __('First Post') : __('Last Post');
    }
    $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 = $start ? "<link rel='start' title='" : "<link rel='end' title='";
    $link .= esc_attr($title);
    $link .= "' href='" . get_permalink($post) . "' />\n";
    $boundary = $start ? 'start' : 'end';
    return apply_filters("{$boundary}_post_rel_link", $link);
}

WordPress Version: 5.4

/**
 * Get boundary post relational link.
 *
 * Can either be start or end post relational link.
 *
 * @since 2.8.0
 * @deprecated 3.3.0
 *
 * @param string $title Optional. Link title format.
 * @param bool $in_same_cat Optional. Whether link should be in a same category.
 * @param string $excluded_categories Optional. Excluded categories IDs.
 * @param bool $start Optional, default is true. Whether to display link to first or last post.
 * @return string
 */
function get_boundary_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '', $start = true)
{
    _deprecated_function(__FUNCTION__, '3.3.0');
    $posts = get_boundary_post($in_same_cat, $excluded_categories, $start);
    // If there is no post, stop.
    if (empty($posts)) {
        return;
    }
    // Even though we limited get_posts() to return only 1 item it still returns an array of objects.
    $post = $posts[0];
    if (empty($post->post_title)) {
        $post->post_title = $start ? __('First Post') : __('Last Post');
    }
    $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 = $start ? "<link rel='start' title='" : "<link rel='end' title='";
    $link .= esc_attr($title);
    $link .= "' href='" . get_permalink($post) . "' />\n";
    $boundary = $start ? 'start' : 'end';
    return apply_filters("{$boundary}_post_rel_link", $link);
}

WordPress Version: 4.6

/**
 * Get boundary post relational link.
 *
 * Can either be start or end post relational link.
 *
 * @since 2.8.0
 * @deprecated 3.3.0
 *
 * @param string $title Optional. Link title format.
 * @param bool $in_same_cat Optional. Whether link should be in a same category.
 * @param string $excluded_categories Optional. Excluded categories IDs.
 * @param bool $start Optional, default is true. Whether to display link to first or last post.
 * @return string
 */
function get_boundary_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '', $start = true)
{
    _deprecated_function(__FUNCTION__, '3.3.0');
    $posts = get_boundary_post($in_same_cat, $excluded_categories, $start);
    // If there is no post stop.
    if (empty($posts)) {
        return;
    }
    // Even though we limited get_posts to return only 1 item it still returns an array of objects.
    $post = $posts[0];
    if (empty($post->post_title)) {
        $post->post_title = $start ? __('First Post') : __('Last Post');
    }
    $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 = $start ? "<link rel='start' title='" : "<link rel='end' title='";
    $link .= esc_attr($title);
    $link .= "' href='" . get_permalink($post) . "' />\n";
    $boundary = $start ? 'start' : 'end';
    return apply_filters("{$boundary}_post_rel_link", $link);
}

WordPress Version: 3.7

/**
 * Get boundary post relational link.
 *
 * Can either be start or end post relational link.
 *
 * @since 2.8.0
 * @deprecated 3.3.0
 *
 * @param string $title Optional. Link title format.
 * @param bool $in_same_cat Optional. Whether link should be in a same category.
 * @param string $excluded_categories Optional. Excluded categories IDs.
 * @param bool $start Optional, default is true. Whether to display link to first or last post.
 * @return string
 */
function get_boundary_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '', $start = true)
{
    _deprecated_function(__FUNCTION__, '3.3');
    $posts = get_boundary_post($in_same_cat, $excluded_categories, $start);
    // If there is no post stop.
    if (empty($posts)) {
        return;
    }
    // Even though we limited get_posts to return only 1 item it still returns an array of objects.
    $post = $posts[0];
    if (empty($post->post_title)) {
        $post->post_title = $start ? __('First Post') : __('Last Post');
    }
    $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 = $start ? "<link rel='start' title='" : "<link rel='end' title='";
    $link .= esc_attr($title);
    $link .= "' href='" . get_permalink($post) . "' />\n";
    $boundary = $start ? 'start' : 'end';
    return apply_filters("{$boundary}_post_rel_link", $link);
}