Trigger adjacent_posts_rel_link() from wp_head only for single post pages to avoid unnecessary queries. see #10867

git-svn-id: http://svn.automattic.com/wordpress/trunk@14019 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2010-04-06 15:06:42 +00:00
parent 8074b8036c
commit a7f987c35a
2 changed files with 14 additions and 1 deletions

View File

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

View File

@ -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.
*