Deprecate the Link Manager (Bookmarks) API (see #56362) - #13358
Deprecate the Link Manager (Bookmarks) API (see #56362)#13358georgestephanis wants to merge 1 commit into
Conversation
See Trac #56362, step 1 of whose rollout plan (moving the functionality to a plugin) is done: https://github.com/georgestephanis/wp-links. This is step 2: flag everything as deprecated ahead of an eventual removal, without changing any behavior -- _deprecated_function(), _deprecated_class(), and _deprecated_file() only emit a notice under WP_DEBUG; every function, class, and page keeps working exactly as before. Deprecates the same surface the companion plugin covers: - get_bookmark(), get_bookmark_field(), get_bookmarks(), sanitize_bookmark(), sanitize_bookmark_field(), clean_bookmark_cache() (wp-includes/bookmark.php) - wp_list_bookmarks() (wp-includes/bookmark-template.php) - get_edit_bookmark_link(), edit_bookmark_link() (wp-includes/link-template.php -- an otherwise-generic file, but these two are part of the Links API) - add_link(), edit_link(), get_default_link_to_edit(), wp_delete_link(), wp_get_link_cats(), get_link_to_edit(), wp_insert_link(), wp_set_link_cats(), wp_update_link() (wp-admin/includes/bookmark.php) - wp_link_category_checklist() (wp-admin/includes/template.php) - WP_Links_List_Table, WP_Widget_Links (via _deprecated_class() in each constructor) - wp-admin/link-manager.php, link.php, link-add.php, edit-link-form.php, link-parse-opml.php, and wp-links-opml.php (via _deprecated_file()) Each @deprecated doc tag and _deprecated_*() call points at the same message: install the WP Links plugin (https://github.com/georgestephanis/wp-links) if this functionality is still needed -- there's no in-core replacement function to point at, since the whole point is the functionality is moving out of core. Deliberately not touched in this pass, matching what the companion plugin doesn't cover either (see its issues WordPress#1 and WordPress#2): the link_category taxonomy registration and manage_links capability mapping (no established core convention for deprecating a taxonomy or capability at runtime the way there is for functions/classes/files), the Links menu entries, the five link_*_meta_box() functions and xfn_check() (internal render callbacks for the now-deprecated edit-link-form.php, deprecating them individually seemed redundant with deprecating that file), the two AJAX handlers, the wp_links DB table, link.js/xfn.js, and the already-19-years-deprecated stubs in wp-includes/deprecated.php. Verified against a real environment (not just PHP lint): every deprecated function/class still works exactly as before -- link category creation, link insert, get_bookmarks(), wp_list_bookmarks() rendering, and widget instantiation all succeed -- while correctly emitting a PHP_DEPRECATED-level notice for each one under WP_DEBUG.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
|
Companion preview PR showing what the eventual final removal (step 5 of #56362's plan) would look like on top of this deprecation: #13360 |
Related: #56362
Step 1 of that ticket's rollout plan — moving the Link Manager functionality into a plugin defensively — is done: https://github.com/georgestephanis/wp-links reproduces this API under the same function/class names, guarded so it activates only once core stops providing them.
This PR is step 2: flag everything as deprecated, with no behavior change.
_deprecated_function(),_deprecated_class(), and_deprecated_file()only emit a notice whenWP_DEBUGis on — every function, class, and admin page here keeps working exactly as it does today. This should be safe to merge well ahead of any actual removal, giving plugin/theme authors real advance notice.What's deprecated
Matches the companion plugin's coverage:
get_bookmark(),get_bookmark_field(),get_bookmarks(),sanitize_bookmark(),sanitize_bookmark_field(),clean_bookmark_cache()wp_list_bookmarks()get_edit_bookmark_link(),edit_bookmark_link()(in the otherwise-genericwp-includes/link-template.php, but part of this API surface)add_link(),edit_link(),get_default_link_to_edit(),wp_delete_link(),wp_get_link_cats(),get_link_to_edit(),wp_insert_link(),wp_set_link_cats(),wp_update_link()wp_link_category_checklist()WP_Links_List_Table,WP_Widget_Links(via_deprecated_class()in each constructor)wp-admin/link-manager.php,link.php,link-add.php,edit-link-form.php,link-parse-opml.php,wp-links-opml.php(via_deprecated_file())Every deprecation message points at installing the companion plugin — there's no in-core replacement function to name, since the point is this functionality moving out of core entirely.
Deliberately not touched here
Matches what the companion plugin doesn't cover either — tracked in its issue #1 and issue #2:
link_categorytaxonomy registration andmanage_linkscapability mapping — no established core convention for deprecating a taxonomy or capability at runtime the way there is for functions/classes/fileslink_*_meta_box()functions andxfn_check()— internal render callbacks for the now-deprecatededit-link-form.php; deprecating them individually seemed redundant with deprecating that filewp_linksDB table,link.js/xfn.jswp-includes/deprecated.phpHow this was verified
Not just PHP lint — tested against a real WordPress environment (WP Playground): link category creation, link insertion,
get_bookmarks(),wp_list_bookmarks()rendering, and widget instantiation all still succeed exactly as before, while each one correctly emits aPHP_DEPRECATED-level notice underWP_DEBUG.