diff --git a/src/wp-content/themes/twentyeleven/header.php b/src/wp-content/themes/twentyeleven/header.php
index 3798e6862d0a8..7746ab1fabb6c 100644
--- a/src/wp-content/themes/twentyeleven/header.php
+++ b/src/wp-content/themes/twentyeleven/header.php
@@ -44,7 +44,6 @@
-
">
-
diff --git a/src/wp-content/themes/twentyfourteen/header.php b/src/wp-content/themes/twentyfourteen/header.php
index 97a4f23174bd1..fc54d7effea8e 100644
--- a/src/wp-content/themes/twentyfourteen/header.php
+++ b/src/wp-content/themes/twentyfourteen/header.php
@@ -15,7 +15,6 @@
-
diff --git a/src/wp-content/themes/twentynineteen/inc/template-functions.php b/src/wp-content/themes/twentynineteen/inc/template-functions.php
index 8e9a732f6116e..e22388d96ad9e 100644
--- a/src/wp-content/themes/twentynineteen/inc/template-functions.php
+++ b/src/wp-content/themes/twentynineteen/inc/template-functions.php
@@ -49,11 +49,8 @@ function twentynineteen_post_classes( $classes ) {
* Adds a pingback url auto-discovery header for single posts, pages, or attachments.
*/
function twentynineteen_pingback_header() {
- if ( is_singular() && pings_open() ) {
- echo '';
- }
+ wp_pingback_link();
}
-add_action( 'wp_head', 'twentynineteen_pingback_header' );
/**
* Changes comment form default fields.
diff --git a/src/wp-content/themes/twentyseventeen/functions.php b/src/wp-content/themes/twentyseventeen/functions.php
index 1f3d347f971f9..5656929360c47 100644
--- a/src/wp-content/themes/twentyseventeen/functions.php
+++ b/src/wp-content/themes/twentyseventeen/functions.php
@@ -427,11 +427,8 @@ function twentyseventeen_javascript_detection() {
* Adds a pingback url auto-discovery header for singularly identifiable articles.
*/
function twentyseventeen_pingback_header() {
- if ( is_singular() && pings_open() ) {
- printf( '' . "\n", esc_url( get_bloginfo( 'pingback_url' ) ) );
- }
+ wp_pingback_link();
}
-add_action( 'wp_head', 'twentyseventeen_pingback_header' );
/**
* Displays custom color CSS.
diff --git a/src/wp-content/themes/twentysixteen/header.php b/src/wp-content/themes/twentysixteen/header.php
index 28deb29619c17..935dd5660d181 100644
--- a/src/wp-content/themes/twentysixteen/header.php
+++ b/src/wp-content/themes/twentysixteen/header.php
@@ -15,9 +15,6 @@
-
-
-
diff --git a/src/wp-content/themes/twentyten/header.php b/src/wp-content/themes/twentyten/header.php
index 02648fb8364a8..e242781f53825 100644
--- a/src/wp-content/themes/twentyten/header.php
+++ b/src/wp-content/themes/twentyten/header.php
@@ -43,7 +43,6 @@
-
-
diff --git a/src/wp-content/themes/twentytwelve/header.php b/src/wp-content/themes/twentytwelve/header.php
index a9f5020394be8..fea78958be2c4 100644
--- a/src/wp-content/themes/twentytwelve/header.php
+++ b/src/wp-content/themes/twentytwelve/header.php
@@ -15,7 +15,6 @@
-
diff --git a/src/wp-content/themes/twentytwentyone/inc/template-functions.php b/src/wp-content/themes/twentytwentyone/inc/template-functions.php
index 529564c295319..096cdeb33c2ed 100644
--- a/src/wp-content/themes/twentytwentyone/inc/template-functions.php
+++ b/src/wp-content/themes/twentytwentyone/inc/template-functions.php
@@ -60,11 +60,8 @@ function twenty_twenty_one_post_classes( $classes ) {
* @return void
*/
function twenty_twenty_one_pingback_header() {
- if ( is_singular() && pings_open() ) {
- echo '';
- }
+ wp_pingback_link();
}
-add_action( 'wp_head', 'twenty_twenty_one_pingback_header' );
/**
* Removes the `no-js` class from body if JS is supported.
diff --git a/src/wp-includes/default-filters.php b/src/wp-includes/default-filters.php
index 3d00e5ae1ba22..90f8e2e7d4021 100644
--- a/src/wp-includes/default-filters.php
+++ b/src/wp-includes/default-filters.php
@@ -359,6 +359,7 @@
add_action( 'wp_head', 'feed_links', 2 );
add_action( 'wp_head', 'feed_links_extra', 3 );
add_action( 'wp_head', 'rsd_link' );
+add_action( 'wp_head', 'wp_pingback_link' );
add_action( 'wp_head', 'locale_stylesheet' );
add_action( 'publish_future_post', 'check_and_publish_future_post', 10, 1 );
add_action( 'wp_head', 'wp_robots', 1 );
diff --git a/src/wp-includes/general-template.php b/src/wp-includes/general-template.php
index e7640720d3c73..f30d4ad09c06b 100644
--- a/src/wp-includes/general-template.php
+++ b/src/wp-includes/general-template.php
@@ -3561,6 +3561,24 @@ function rsd_link() {
);
}
+/**
+ * Displays the link to the pingback XML-RPC endpoint.
+ *
+ * @since 7.1.0
+ *
+ * @return void
+ */
+function wp_pingback_link() {
+ if ( ! is_singular() || ! pings_open( get_queried_object() ) ) {
+ return;
+ }
+
+ printf(
+ '' . "\n",
+ esc_url( get_bloginfo( 'pingback_url', 'display' ) )
+ );
+}
+
/**
* Displays a referrer `strict-origin-when-cross-origin` meta tag.
*
diff --git a/src/wp-includes/theme-compat/header.php b/src/wp-includes/theme-compat/header.php
index 340477fb94f1e..a8888d88689ca 100644
--- a/src/wp-includes/theme-compat/header.php
+++ b/src/wp-includes/theme-compat/header.php
@@ -24,7 +24,6 @@
-