Merge pull request #853 from jrfnl/feature/conditional-pingback-header

Only generate pingback url header tag when relevant.
This commit is contained in:
David A. Kennedy 2016-09-02 19:37:25 -04:00 committed by GitHub
commit ff4b374d6b
2 changed files with 10 additions and 1 deletions

View File

@ -15,7 +15,6 @@
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="profile" href="http://gmpg.org/xfn/11">
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
<?php wp_head(); ?>
</head>

View File

@ -27,3 +27,13 @@ function _s_body_classes( $classes ) {
return $classes;
}
add_filter( 'body_class', '_s_body_classes' );
/**
* Add a pingback url auto-discovery header for singularly identifiable articles.
*/
function _s_pingback_header() {
if ( is_singular() && pings_open() ) {
echo '<link rel="pingback" href="', bloginfo( 'pingback_url' ), '">';
}
}
add_action( 'wp_head', '_s_pingback_header' );