Skip to content

Deprecate the Link Manager (Bookmarks) API (see #56362) - #13358

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

Deprecate the Link Manager (Bookmarks) API (see #56362)#13358
georgestephanis wants to merge 1 commit into
WordPress:trunkfrom
georgestephanis:deprecate/link-manager-56362

Conversation

@georgestephanis

Copy link
Copy Markdown

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 when WP_DEBUG is 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-generic wp-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:

  • 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 Links-specific AJAX handlers
  • The wp_links DB table, link.js/xfn.js
  • The already-19-years-deprecated stubs in wp-includes/deprecated.php

How 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 a PHP_DEPRECATED-level notice under WP_DEBUG.

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

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

@georgestephanis

Copy link
Copy Markdown
Author

Companion preview PR showing what the eventual final removal (step 5 of #56362's plan) would look like on top of this deprecation: #13360

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