diff --git a/wp-includes/default-filters.php b/wp-includes/default-filters.php index 2f1962cdcb..7a8c7842fa 100644 --- a/wp-includes/default-filters.php +++ b/wp-includes/default-filters.php @@ -182,7 +182,7 @@ add_action( 'wp_head', 'wlwmanifest_link' ); add_action( 'wp_head', 'index_rel_link' ); add_action( 'wp_head', 'parent_post_rel_link', 10, 0 ); add_action( 'wp_head', 'start_post_rel_link', 10, 0 ); -add_action( 'wp_head', 'adjacent_posts_rel_link', 10, 0 ); +add_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0 ); add_action( 'wp_head', 'locale_stylesheet' ); add_action( 'publish_future_post', 'check_and_publish_future_post', 10, 1 ); add_action( 'wp_head', 'noindex', 1 ); diff --git a/wp-includes/link-template.php b/wp-includes/link-template.php index 66b51ba2ec..d207cbaa21 100644 --- a/wp-includes/link-template.php +++ b/wp-includes/link-template.php @@ -1094,6 +1094,19 @@ function adjacent_posts_rel_link($title = '%title', $in_same_cat = false, $exclu echo get_adjacent_post_rel_link($title, $in_same_cat, $excluded_categories = '', false); } +/** + * Display relational links for the posts adjacent to the current post for single post pages. + * + * This is meant to be attached to actions like 'wp_head'. Do not call this directly in plugins or theme templates. + * @since 3.0.0 + * + */ +function adjacent_posts_rel_link_wp_head() { + if ( !is_singular() || is_attachment() ) + return; + adjacent_posts_rel_link(); +} + /** * Display relational link for the next post adjacent to the current post. *