Skip to content

Add, fix, update bookmark related functions #359

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 20, 2025

Conversation

IanDelMar
Copy link
Contributor

Notes

  • add_link(), edit_link(), and wp_update_link() all call wp_insert_link() with the default $wp_error value (false). Therefore, none of these functions returns WP_Error. (For wp_update_link() the documentation was misleading; and I incorrectly added WP_Error to the return type in Narrow return type of wp_update_link() #357.)
  • The $field parameter has been narrowed for get_bookmark_field() and sanitize_bookmark_field() to be a key of the $linkdata array (see wp_insert_link()). Enforcing this allows the return type to be narrowed accurately. For get_bookmark_field(), the documented type was incorrect; compared with the documented type, the actual return type is wider.
  • Tests reorganised: all admin-related bookmark functions are now in bookmark-admin.php; general bookmark functions are in bookmark.php.

Hopefully, this is the end of my bookmarks journey. 🙂

@szepeviktor
Copy link
Member

As far as I remember bookmarks are disabled in WordPress ...

@szepeviktor szepeviktor merged commit 9d3cdfb into php-stubs:master Aug 20, 2025
7 checks passed
@IanDelMar
Copy link
Contributor Author

Well, 😂

@IanDelMar IanDelMar deleted the add_link branch August 20, 2025 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants