#64764 closed defect (bug) (fixed)
Incorrect documented return type for bookmark functions add_link(), edit_link(), and wp_update_link()
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 7.0 | Priority: | normal |
| Severity: | minor | Version: | |
| Component: | Administration | Keywords: | has-patch |
| Focuses: | docs, administration | Cc: |
Description
The functions add_link(), edit_link(), and wp_update_link() are documented as returning int|WP_Error.
In practice, they never return a WP_Error instance. All three ultimately call wp_insert_link(), whose second parameter ($wp_error) controls whether failures are returned as WP_Error or as 0. The parameter defaults to false, and none of these wrapper functions passes true (nor do they expose a parameter to allow it).
As a result, these functions return an integer in all cases: 0 on failure, and the link ID on success. Their @return tags should therefore be updated to int.
Change History (4)
This ticket was mentioned in PR #11094 on WordPress/wordpress-develop by @marian1.
7 weeks ago
#1
- Keywords has-patch added
#3
@
5 weeks ago
- Owner set to SergeyBiryukov
- Resolution set to fixed
- Status changed from new to closed
In 62024:
@westonruter commented on PR #11094:
5 weeks ago
#4
Added props for @apermo and myself in Core Props.
Trac ticket: https://core.trac.wordpress.org/ticket/64764
## Use of AI Tools