Opened 2 years ago
Closed 2 years ago
#57047 closed defect (bug) (fixed)
Misleading PHPdoc for filter {$adjacent}_post_link
Reported by: | apermo | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | 6.2 | Priority: | normal |
Severity: | normal | Version: | 4.2 |
Component: | Posts, Post Types | Keywords: | has-patch |
Focuses: | docs | Cc: |
Description
The documentation for the filter {$adjacent}_post_link inside /wp-includes/link-template.php suggests that $post is a WP_Post.
The function get_adjacent_post() though will deliver an empty string if there is no adjacent post.
It is arguable if get_adjacent_post() shouldn't return null in that case, but nevertheless, in it's current state, the PHPdoc for the filter is misleading. If one uses these for typehinting, a fatal error will be thrown.
I've attached a patch, with my suggestion for an updated PHPdoc.
Attachments (1)
Change History (5)
#1
@
2 years ago
- Keywords has-patch added
- Version changed from 6.1 to 4.2
Hello, thanks for the ticket and for the related patch,
Maybe we could use a similar wording than the one used in the get_adjacent_post()
function?
Empty string if no corresponding post exists.
Updating the Version tag to 4.2 as this filter was added in this version.
Patch of the PHPdoc.