mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-16 11:35:48 +00:00
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:
parent
8074b8036c
commit
a7f987c35a
@ -182,7 +182,7 @@ add_action( 'wp_head', 'wlwmanifest_link' );
|
|||||||
add_action( 'wp_head', 'index_rel_link' );
|
add_action( 'wp_head', 'index_rel_link' );
|
||||||
add_action( 'wp_head', 'parent_post_rel_link', 10, 0 );
|
add_action( 'wp_head', 'parent_post_rel_link', 10, 0 );
|
||||||
add_action( 'wp_head', 'start_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( 'wp_head', 'locale_stylesheet' );
|
||||||
add_action( 'publish_future_post', 'check_and_publish_future_post', 10, 1 );
|
add_action( 'publish_future_post', 'check_and_publish_future_post', 10, 1 );
|
||||||
add_action( 'wp_head', 'noindex', 1 );
|
add_action( 'wp_head', 'noindex', 1 );
|
||||||
|
@ -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);
|
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.
|
* Display relational link for the next post adjacent to the current post.
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user