Opened 7 years ago
Closed 7 years ago
#41842 closed enhancement (duplicate)
pingback() doesn't return anything
Reported by: | mrmadhat | Owned by: | |
---|---|---|---|
Milestone: | Priority: | low | |
Severity: | minor | Version: | 2.1 |
Component: | Pings/Trackbacks | Keywords: | needs-patch needs-unit-tests |
Focuses: | Cc: |
Description
The pingback() function doesn't return any value. This makes it hard to test and validate that it worked.
Attachments (2)
Change History (8)
#3
follow-up:
↓ 4
@
7 years ago
Hello @mrmadhat,
welcome to trac and thanks for your patch.
With this change, you have to add a return type to the function DocBlock see Inline documentation standards.
#5
@
7 years ago
- Priority changed from normal to low
- Severity changed from normal to minor
This is a good simple fix, but this is problematic because it doesn't really validate whether it worked per se, it measures whether or not the post ID exists. It doesn't measure whether the pingbacks themselves succeed.
So the question is...what is success and failure in this case?
What I would suggest is splitting sending a single pingback into its own function, for example, 'ping' with the arguments $pagelinkedfrom, $pagelinkedto which will return success of failure for a single ping.
The problem is then...if a URL has multiple links in it, and it tries to ping all of them, what constitutes failure? Do they all have to be true? Sometimes, some of them don't have pingback support? Is that a success or a failure?
It may be better to return a WP_Error object that can attach additional data.
Will return false on failure and true on success