Skip to content

Preview: remove the Link Manager (Bookmarks) API from core (see #56362) - #13360

Open
georgestephanis wants to merge 1 commit into
WordPress:trunkfrom
georgestephanis:remove/link-manager-preview-56362
Open

Preview: remove the Link Manager (Bookmarks) API from core (see #56362)#13360
georgestephanis wants to merge 1 commit into
WordPress:trunkfrom
georgestephanis:remove/link-manager-preview-56362

Conversation

@georgestephanis

Copy link
Copy Markdown

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_category taxonomy and manage_links capability, the admin pages, the widget, and OPML. Deliberately not touched here, tracked in issue #1 and issue #2 of that repo:

  • The wp_links DB table creation in wp-admin/includes/schema.php
  • wp-admin/js/link.js / xfn.js and their registrations
  • The ~10 already-19-years-deprecated Links functions in wp-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-op
  • The PHPUnit test suite (tests/phpunit/tests/link*.php, bookmark/*)

Worth flagging from putting this together

  • wp-includes/bookmark.php / bookmark-template.php are required unconditionally in wp-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() and wp_ajax_delete_link() in wp-admin/includes/ajax-actions.php aren'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.
  • A stray 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:

  1. A normal install boots and runs fine with everything in this diff removed.
  2. With the companion plugin active on top of that stripped install: link category creation, link insert/list, front-end wp_list_bookmarks() rendering, and the admin list-table page all work exactly as before, entirely through the plugin's polyfills.

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.
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown

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 props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props georgestephanis.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@georgestephanis

Copy link
Copy Markdown
Author

Opened alongside a real, mergeable deprecation-only PR for the intermediate steps of #56362's plan (no behavior change, just notices): #13358

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown

Test using WordPress Playground

The 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

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

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.

1 participant