Pings/Trackbacks: Split do_all_pings() into several functions:

* `do_all_pingbacks()`
* `do_all_enclosures()`
* `do_all_trackbacks()`

This allows for the specific removal/replacement of one of more services.

Props dshanske, garrett-eclipse, Mista-Flo, azaozz, hellofromTonya.
Fixes #36576.

git-svn-id: https://develop.svn.wordpress.org/trunk@49211 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2020-10-19 21:14:06 +00:00
parent bcfa865733
commit 052ac08385
2 changed files with 32 additions and 9 deletions

View File

@ -2800,13 +2800,23 @@ function discover_pingback_server_uri( $url, $deprecated = '' ) {
* Perform all pingbacks, enclosures, trackbacks, and send to pingback services.
*
* @since 2.1.0
*
* @global wpdb $wpdb WordPress database abstraction object.
* @since 5.6.0 Introduced `do_all_pings` action hook for individual services.
*/
function do_all_pings() {
global $wpdb;
/**
* Fires immediately after the `do_pings` event to hook services individually.
*
* @since 5.6.0
*/
do_action( 'do_all_pings' );
}
// Do pingbacks.
/**
* Perform all pingbacks.
*
* @since 5.6.0
*/
function do_all_pingbacks() {
$pings = get_posts(
array(
'post_type' => get_post_types(),
@ -2821,8 +2831,14 @@ function do_all_pings() {
delete_post_meta( $ping, '_pingme' );
pingback( null, $ping );
}
}
// Do enclosures.
/**
* Perform all enclosures.
*
* @since 5.6.0
*/
function do_all_enclosures() {
$enclosures = get_posts(
array(
'post_type' => get_post_types(),
@ -2837,8 +2853,14 @@ function do_all_pings() {
delete_post_meta( $enclosure, '_encloseme' );
do_enclose( null, $enclosure );
}
}
// Do trackbacks.
/**
* Perform all trackbacks.
*
* @since 5.6.0
*/
function do_all_trackbacks() {
$trackbacks = get_posts(
array(
'post_type' => get_post_types(),
@ -2853,9 +2875,6 @@ function do_all_pings() {
delete_post_meta( $trackback, '_trackbackme' );
do_trackbacks( $trackback );
}
// Do Update Services/Generic Pings.
generic_ping();
}
/**

View File

@ -342,6 +342,10 @@ add_action( 'do_feed_rss', 'do_feed_rss', 10, 0 );
add_action( 'do_feed_rss2', 'do_feed_rss2', 10, 1 );
add_action( 'do_feed_atom', 'do_feed_atom', 10, 1 );
add_action( 'do_pings', 'do_all_pings', 10, 0 );
add_action( 'do_all_pings', 'do_all_pingbacks', 10, 0 );
add_action( 'do_all_pings', 'do_all_enclosures', 10, 0 );
add_action( 'do_all_pings', 'do_all_trackbacks', 10, 0 );
add_action( 'do_all_pings', 'generic_ping', 10, 0 );
add_action( 'do_robots', 'do_robots' );
add_action( 'do_favicon', 'do_favicon' );
add_action( 'set_comment_cookies', 'wp_set_comment_cookies', 10, 3 );