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

git-svn-id: https://develop.svn.wordpress.org/trunk@14019 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2010-04-06 15:06:42 +00:00
parent bc13365e82
commit 6f1de4e209
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.
*