Skip to content

Commit

Permalink
Merge pull request #853 from jrfnl/feature/conditional-pingback-header
Browse files Browse the repository at this point in the history
Only generate pingback url header tag when relevant.
  • Loading branch information
davidakennedy authored Sep 2, 2016
2 parents f9471cd + 9638b7e commit ff4b374
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 0 additions & 1 deletion header.php
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
10 changes: 10 additions & 0 deletions inc/extras.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' );

0 comments on commit ff4b374

Please sign in to comment.