[wp-trac] [WordPress Trac] #64764: Incorrect documented return type for bookmark functions add_link(), edit_link(), and wp_update_link()
WordPress Trac
noreply at wordpress.org
Sat Feb 28 19:07:58 UTC 2026
#64764: Incorrect documented return type for bookmark functions add_link(),
edit_link(), and wp_update_link()
----------------------------------+-----------------------------
Reporter: marian1 | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Administration | Version:
Severity: minor | Keywords:
Focuses: docs, administration |
----------------------------------+-----------------------------
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`.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/64764>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list