Preview: remove the Link Manager (Bookmarks) API from core (see #56362) - #13360
Preview: remove the Link Manager (Bookmarks) API from core (see #56362)#13360georgestephanis wants to merge 1 commit into
Conversation
See Trac #56362. This is a preview/reference patch, not proposed for merging as-is -- #56362's own rollout plan puts a full removal as the LAST of five phased steps, after deprecation notices ship in a release and a full cycle passes. This is included to make that eventual step concrete, alongside a working standalone plugin (https://github.com/georgestephanis/wp-links) that polyfills everything removed here via function_exists()/class_exists() guards. Scope matches that plugin's current coverage exactly: - wp-includes/bookmark.php, bookmark-template.php (and their two unconditional requires in wp-settings.php -- these aren't guarded the way most of core's Links code is, so simply deleting the files without also removing these two lines breaks the entire bootstrap; caught by testing this against a real environment, not just review) - wp-admin/includes/bookmark.php, class-wp-links-list-table.php (and their require in wp-admin/includes/admin.php / whitelist entry in wp-admin/includes/list-table.php) - wp-includes/widgets/class-wp-widget-links.php (and its require in wp-includes/default-widgets.php, and the now-dangling register_widget() call in wp_widgets_init() that would otherwise fatal on a class that no longer exists) - get_edit_bookmark_link()/edit_bookmark_link() (wp-includes/link-template.php -- otherwise-generic file, but these two functions are part of the Links API surface) - wp-admin/link-manager.php, link.php, link-add.php, edit-link-form.php, link-parse-opml.php, wp-links-opml.php - The link_category taxonomy registration (wp-includes/taxonomy.php) and the manage_links capability case (wp-includes/capabilities.php) - The Links menu entries (wp-admin/menu.php) and admin bar "Add New Link" entry (wp-includes/admin-bar.php) - wp_link_category_checklist() and the five link_*_meta_box() functions plus xfn_check() (wp-admin/includes/template.php and wp-admin/includes/meta-boxes.php) - wp_ajax_add_link_category() and wp_ajax_delete_link() (and their action-name whitelist entries in wp-admin/admin-ajax.php) -- these aren't part of the plugin's own coverage (no AJAX quick-add/delete reproduced there either, tracked as a known gap), but left in place they'd fatal immediately on the now-undefined functions they call, which seemed worse than removing them - The stray wp_list_bookmarks() call in the default theme-compat fallback sidebar (wp-includes/theme-compat/sidebar.php) Deliberately NOT touched, left for a real removal patch to handle (also matches what the companion plugin doesn't cover yet -- see georgestephanis/wp-links#1 and WordPress/issues/2): - The wp_links DB table creation in wp-admin/includes/schema.php, and the now-meaningless default_link_category/link_manager_enabled option defaults there - wp-admin/js/link.js and xfn.js, and their registrations in wp-includes/script-loader.php - The ~10 already-19-years-deprecated Links-era functions in wp-includes/deprecated.php (get_linksbyname(), wp_get_links(), etc.) -- these call into functions removed here and would now fatal if ever invoked; a real patch needs to either remove them too or give them a graceful no-op - The PHPUnit test suite (tests/phpunit/tests/link*.php, bookmark/*) Verified two ways against a real WordPress checkout (not just PHP lint): a normal install boots and loads fine with everything above removed, and -- with the companion plugin active on top -- link category creation, link insert/list/render, and the admin list-table page all work exactly as before via the plugin's polyfills.
|
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. |
|
Opened alongside a real, mergeable deprecation-only PR for the intermediate steps of #56362's plan (no behavior change, just notices): #13358 |
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. |
Related: #56362
This is a preview/reference patch, not proposed for merging as-is. #56362's own rollout plan puts a full removal as the last of five phased steps — after deprecation notices ship in a release and a full cycle passes. Opening this to make that eventual step concrete and grounded in real code, alongside a working standalone plugin that already polyfills everything removed here: https://github.com/georgestephanis/wp-links
That plugin reproduces this functionality under the same function/class names, each guarded with
function_exists()/class_exists()(or an equivalent technique where a guard doesn't directly apply — see its README for the specifics), so it activates dormant on a normal install and takes over the moment core stops providing this.Scope
Matches the companion plugin's current coverage exactly — the API functions/classes, the
link_categorytaxonomy andmanage_linkscapability, the admin pages, the widget, and OPML. Deliberately not touched here, tracked in issue #1 and issue #2 of that repo:wp_linksDB table creation inwp-admin/includes/schema.phpwp-admin/js/link.js/xfn.jsand their registrationswp-includes/deprecated.php(get_linksbyname(),wp_get_links(), etc.) — these call into functions removed here and would fatal if ever invoked; a real patch needs to either remove them too or give them a graceful no-optests/phpunit/tests/link*.php,bookmark/*)Worth flagging from putting this together
wp-includes/bookmark.php/bookmark-template.phparerequired unconditionally inwp-settings.php— not guarded the way most of core's Links code is. Deleting the files without also removing those two lines breaks the bootstrap entirely. Only caught by actually booting a build, not by review — see the "How this was verified" note below.wp_ajax_add_link_category()andwp_ajax_delete_link()inwp-admin/includes/ajax-actions.phparen't reproduced by the companion plugin (its own known gap), but leaving them in core while removing the functions they call (get_taxonomy('link_category'),get_bookmark(),wp_delete_link()) would leave two guaranteed-fatal AJAX handlers behind, so they're removed here too rather than left dangling.wp_list_bookmarks()call in the default theme-compat fallback sidebar (wp-includes/theme-compat/sidebar.php) needed removing as well.How this was verified
Not just PHP lint — tested against a real WordPress environment (WP Playground) two ways:
wp_list_bookmarks()rendering, and the admin list-table page all work exactly as before, entirely through the plugin's polyfills.