wp_links

Legacy blogroll/links table. Deprecated since WordPress 3.5 (2012) but still present for backward compatibility.

Schema

ColumnTypeNullDefaultDescription
link_idbigint(20) unsignedNOauto_incrementUnique identifier
link_urlvarchar(255)NOLink URL
link_namevarchar(255)NOLink title/name
link_imagevarchar(255)NOImage URL for link
link_targetvarchar(25)NOTarget: _blank, _top, etc.
link_descriptionvarchar(255)NOShort description
link_visiblevarchar(20)NO‘Y’Visibility: Y or N
link_ownerbigint(20) unsignedNO1User ID who created link
link_ratingint(11)NO0Rating (0-10)
link_updateddatetimeNO0000-00-00 00:00:00Last update timestamp
link_relvarchar(255)NORelationship (XFN values)
link_notesmediumtextNONULLPrivate notes
link_rssvarchar(255)NORSS feed URL

Indexes

Key NameColumnsUniquePurpose
PRIMARYlink_idYesPrimary key
link_visiblelink_visibleNoFilter visible links

Foreign Key Relationships

  • link_ownerwp_users.ID

Links can be categorized using the taxonomy system:

  • wp_term_relationships.object_id = wp_links.link_id
  • Taxonomy: link_category

Deprecation Status

The Links Manager was hidden in WordPress 3.5 (December 2012):

  • UI removed from core
  • Table still created for new installations
  • API functions still work
  • Link Manager plugin can restore the UI

Common Queries

sql
SELECT * FROM wp_links 
WHERE link_visible = 'Y' 
ORDER BY link_name;
sql
SELECT l.*, t.name as category
FROM wp_links l
JOIN wp_term_relationships tr ON l.link_id = tr.object_id
JOIN wp_term_taxonomy tt ON tr.term_taxonomy_id = tt.term_taxonomy_id
JOIN wp_terms t ON tt.term_id = t.term_id
WHERE tt.taxonomy = 'link_category'
  AND l.link_visible = 'Y'
ORDER BY t.name, l.link_name;
sql
SELECT l.*
FROM wp_links l
JOIN wp_term_relationships tr ON l.link_id = tr.object_id
JOIN wp_term_taxonomy tt ON tr.term_taxonomy_id = tt.term_taxonomy_id
JOIN wp_terms t ON tt.term_id = t.term_id
WHERE t.slug = 'blogroll'
  AND tt.taxonomy = 'link_category'
  AND l.link_visible = 'Y';

WordPress API Functions

These functions still work but may require the Link Manager plugin for UI:

  • get_bookmarks( $args ) – Get links/bookmarks
  • wp_insert_link( $linkdata ) – Insert link
  • wp_update_link( $linkdata ) – Update link
  • wp_delete_link( $link_id ) – Delete link
  • get_bookmark( $link_id ) – Get single link

XFN Relationships

The link_rel column supports XFN (XHTML Friends Network) values:

ValueMeaning
friendFriend
acquaintanceAcquaintance
contactContact
metHave met in person
co-workerCo-worker
colleagueColleague
co-residentCo-resident
neighborNeighbor
childChild
parentParent
siblingSibling
spouseSpouse
kinFamily
museMuse
crushCrush
dateDate
sweetheartSweetheart
meAnother site of mine

Multiple values can be space-separated.

Migration Alternatives

For modern link collections, consider:

  • Custom post type for links
  • Navigation menus
  • Block pattern with link blocks
  • Third-party bookmark plugins

Removal

If not using links, the table can be safely ignored. To remove:

sql
-- Only if you're sure you don't need it
DROP TABLE IF EXISTS wp_links;

Note: This is generally not recommended as it may confuse future debugging.