diff --git wp-includes/deprecated.php wp-includes/deprecated.php
index 582b2fd..a255015 100644
--- wp-includes/deprecated.php
+++ wp-includes/deprecated.php
@@ -2634,7 +2634,7 @@ function get_boundary_post_rel_link($title = '%title', $in_same_cat = false, $ex
 
 	$posts = get_boundary_post($in_same_cat, $excluded_categories, $start);
 	// If there is no post stop.
-	if ( empty($posts) )
+	if ( empty($posts) || ! is_single() || is_attachment() )
 		return;
 
 	// Even though we limited get_posts to return only 1 item it still returns an array of objects.
diff --git wp-includes/link-template.php wp-includes/link-template.php
index 656313e..6fdfef6 100644
--- wp-includes/link-template.php
+++ wp-includes/link-template.php
@@ -1753,7 +1753,7 @@ function prev_post_rel_link( $title = '%title', $in_same_term = false, $excluded
  */
 function get_boundary_post( $in_same_term = false, $excluded_terms = '', $start = true, $taxonomy = 'category' ) {
 	$post = get_post();
-	if ( ! $post || ! is_single() || is_attachment() || ! taxonomy_exists( $taxonomy ) )
+	if ( ! taxonomy_exists( $taxonomy ) )
 		return null;
 
 	$query_args = array(
