WordPress.org

Make WordPress Core

Opened 10 months ago

Last modified 3 months ago

#38197 new enhancement

Update Pingback function To Add Return

Reported by: dshanske Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Pings/Trackbacks Keywords: good-first-bug needs-patch
Focuses: performance Cc:

Description (last modified by dshanske)

Related to #36824.

Updated to reflect focus on the return issue.

In #36824, the proposal was to improve performance of the do_all_pings function. Part of this involves the fact that if a pending trackback URL is sent a pingback successfully, it should not also send a trackback.

The function should also optionally return which URLs were successfully pinged or a WP_Error object in the event the sending fails, etc.

This would change the signature of the function but would allow for debugging, response to errors, as well as assist in optimizing the do_all_pings function.

The original proposal was to deprecate pingback because it includes $content, a parameter better retrieved from the post itself for purposes of integrity. However, that can be addressed in other ways.

Change History (4)

#1 @dshanske
9 months ago

  • Description modified (diff)
  • Summary changed from Deprecate and Replace Pingback() Function to Update Pingback function To Add Return

#2 @welcher
3 months ago

  • Keywords needs-patch added

#3 @shulard
3 months ago

Hello !

I'm actually trying to make a patch for that ticket, but can't find a clean way to handle this. The pingback function can ping multiple URLs in one call, how the return value can be consistent with that :

  • Always return an array of found URL as key and true / WP_Error if URL was pinged successfully or not ?
  • Return an array of pinged URL or a WP_Error if at leat one failed ?
Last edited 3 months ago by shulard (previous) (diff)

#4 @dshanske
3 months ago

You are right, handling this is difficult.

My suggestion is to start by splitting the code that sends a single ping based on a URL into a new function with a return. This will get a single true/false to build an array. We can also add split the function to find the content in a content block.

That would allow the existing function to call them but future changes in do_all_pings to call each piece independently.

In the meantime, pingback can return true if all successful, which should shutdown Trackbacks for the post_id.

Note: See TracTickets for help on using tickets.