Skip to content

Database tables ​

Look up every column, type, default and index of the eight Link Manager Pro tables, and see what writes to each one.

Link Manager Pro creates eight tables named {$wpdb->prefix}link_manager_pro_{name}. Migrations in database/Migrations build them with WordPress dbDelta(), and every index is part of its CREATE TABLE.

Migrations run on activation and, when the stored plugin version trails the running one, when the plugin loads. The option link_manager_pro_version records the version the tables were last migrated for. For where everything else lives, see Where Link Manager Pro stores data.

The schema builder maps the migration methods to these MySQL types:

Builder methodColumn type
id()bigint unsigned NOT NULL AUTO_INCREMENT, the primary key
unsignedBigInteger()bigint unsigned
integer()int
boolean()tinyint(1)
string('x', 64)varchar(64)
text()text
dateTime()datetime
timestamps()created_at and updated_at, both timestamp NULL
enum()enum(...)

A column is NOT NULL unless the table below says NULL. Fields stored as JSON, such as keywords, are text columns. The models decode them to arrays.

Don't write to these tables directly. Use the REST API or the hooks so caches and counters stay correct.

The tables ​

One row per short link.

ColumnTypeComment
idbigint unsigned NOT NULL AUTO_INCREMENTPrimary key
slugvarchar(64) NOT NULLThe address part after the short link prefix
target_urltext NOT NULLThe destination
redirect_typeint NOT NULL DEFAULT 302The HTTP status of the redirect
sourcevarchar(16) NOT NULL DEFAULT 'manual'How the link was created: manual, scan, editor, affiliate, health, ai, automatorwp, imported, prettylinks, betterlinks, thirstyaff or redirect (a redirect's hidden link)
url_hashvarchar(32) NOT NULLA 32-character hash of the destination
keywordstext NULLJSON array of auto-link keywords
enable_autolinktinyint(1) NOT NULL DEFAULT 0Whether auto-linking uses this link
autolink_priorityint NOT NULL DEFAULT 10Auto-link order
link_attributestext NULLJSON object of link attributes
click_countint NOT NULL DEFAULT 0Total clicks
forward_paramstinyint(1) NOT NULL DEFAULT 0Whether visitor query parameters pass to the destination
link_passwordvarchar(255) NULLThe link's password, stored as a WordPress password hash
utm_paramstext NULLJSON object of this link's UTM values
active_fromdatetime NULLThe link starts working at this time
expires_atdatetime NULLThe link stops working at this time
created_attimestamp NULL
updated_attimestamp NULL

Indexes: slug, url_hash, enable_autolink, click_count. All are plain keys, not unique keys.

Written by: creating, editing and deleting short links, imports from other plugins, backup restore, and Simple Redirects, which keep a short link row with source set to redirect.

One row per recorded click.

ColumnTypeComment
idbigint unsigned NOT NULL AUTO_INCREMENTPrimary key
click_typevarchar(20) NOT NULL DEFAULT 'masked'masked for a short link click, internal for a tracked internal link click
link_idbigint unsigned NULLThe short link. Empty for internal clicks
post_idbigint unsigned NULLThe post the click came from, for internal clicks
user_idbigint unsigned NULLThe logged-in WordPress user, if any
cookie_idvarchar(64) NULLThe visitor's link_manager_pro_id cookie value
is_uniquetinyint(1) NOT NULL DEFAULT 1Whether the click counted as unique
ip_addressvarchar(45) NULLThe visitor IP, anonymized if that setting is on
user_agenttext NULLThe browser's user agent
country_codevarchar(2) NULLTwo-letter country code
referrer_urlvarchar(2048) NULLThe Referer URL
referrer_domainvarchar(255) NULLThe Referer host
matched_rule_idbigint unsigned NULLThe routing rule that chose the destination. Saving a link's rules recreates them with new IDs, so an older click can point to a rule that no longer exists
target_urlvarchar(2048) NULLThe destination, for internal clicks
target_url_hashvarchar(64) NULLSHA-256 of the destination, for internal clicks
anchor_textvarchar(500) NULLThe link text, for internal clicks
clicked_atdatetime NOT NULLWhen the click happened, in UTC
created_attimestamp NULL
updated_attimestamp NULL

Indexes: link_id; clicked_at; post_id; link_id, cookie_id; link_id, ip_address; click_type, post_id, target_url_hash, named lmp_clicks_internal_dedupe_idx.

Written by: short link redirects and the internal click tracker. Imports from other plugins and backup restore also write click rows. Inbound utm_* values for a click go to the meta table, not to this one.

One row per affiliate partner.

ColumnTypeComment
idbigint unsigned NOT NULL AUTO_INCREMENTPrimary key
site_namevarchar(100) NOT NULLThe partner's display name
domainvarchar(100) NOT NULLThe partner's domain
affiliate_linktext NOT NULLThe affiliate link
keywordstext NULLJSON array of auto-link keywords
enable_autolinktinyint(1) NOT NULL DEFAULT 0Whether auto-linking uses this partner
autolink_priorityint NOT NULL DEFAULT 10Auto-link order
attributestext NULLLink attributes
utm_paramstext NULLUTM values
redirect_typeint NOT NULL DEFAULT 301The HTTP status of the redirect
click_countint NOT NULL DEFAULT 0Total clicks
created_attimestamp NULL
updated_attimestamp NULL

Indexes: domain, enable_autolink, click_count.

Written by: the affiliates screen and its REST routes, and backup restore. The partner's Auto-link only on choice is stored in the meta table with entity_type affiliate.

One row per broken link found by Link Health.

ColumnTypeComment
idbigint unsigned NOT NULL AUTO_INCREMENTPrimary key
urltext NOT NULLThe broken URL
source_post_idbigint unsigned NULLThe post that links to it
health_typeenum('content','traffic') NOT NULLcontent for a link found in a post, traffic for a visitor 404
status_codeint NULLThe HTTP status found
referrertext NULLThe referring page
hitsint NOT NULL DEFAULT 1How often it was detected
last_detecteddatetime NOT NULLWhen it was last detected, in UTC
statusenum('active','ignored','fixed') NOT NULL DEFAULT 'active'Where the issue stands
created_attimestamp NULL
updated_attimestamp NULL

Indexes: health_type, status; status; source_post_id.

Written by: Link Health scans, visitor 404 logging and backup restore. The daily purge removes old traffic rows when that retention setting is on.

One row per Simple Redirect. The destination lives on a short link row that the redirect points to.

ColumnTypeComment
idbigint unsigned NOT NULL AUTO_INCREMENTPrimary key
source_urltext NOT NULLThe old address
source_url_hashvarchar(32) NOT NULLA 32-character hash of the old address
target_link_idbigint unsigned NOT NULLThe links row that holds the destination
statusvarchar(50) NOT NULL DEFAULT 'active'The redirect's state
created_attimestamp NULL
updated_attimestamp NULL

Indexes: source_url_hash, target_link_id, status.

Written by: creating and editing Simple Redirects, and backup restore.

One row per routing rule of a short link.

ColumnTypeComment
idbigint unsigned NOT NULL AUTO_INCREMENTPrimary key
link_idbigint unsigned NOT NULLThe short link the rule belongs to
namevarchar(120) NULLThe rule's name
is_activetinyint(1) NOT NULL DEFAULT 1Whether the rule is on
priorityint NOT NULL DEFAULT 100Evaluation order
match_modevarchar(10) NOT NULL DEFAULT 'all'all or any: whether every condition or one condition must match
target_urltext NOT NULLThe destination when the rule matches
redirect_typeint NOT NULL DEFAULT 302The HTTP status of the redirect
start_atdatetime NULLThe rule starts at this time
end_atdatetime NULLThe rule ends at this time
conditionstext NULLJSON list of conditions
created_attimestamp NULL
updated_attimestamp NULL

Indexes: link_id, is_active, priority.

Written by: the routing rules REST routes and screen, and backup restore.

One row per post that Link Audit has scanned.

ColumnTypeComment
idbigint unsigned NOT NULL AUTO_INCREMENTPrimary key
post_idbigint unsigned NOT NULLThe scanned post
post_typevarchar(20) NOT NULL DEFAULT 'post'The post's type
post_titlevarchar(255) NOT NULL DEFAULT ''The post's title
inbound_internalint NOT NULL DEFAULT 0Internal links pointing to the post
outbound_internalint NOT NULL DEFAULT 0Internal links the post contains
outbound_externalint NOT NULL DEFAULT 0External links the post contains
statusvarchar(20) NOT NULL DEFAULT 'healthy'healthy, weak or orphaned
scanned_atdatetime NULLWhen the post was last scanned
created_attimestamp NULL
updated_attimestamp NULL

Indexes: post_id.

Written by: Link Audit scans and the sync that runs when a post or a short link changes. A backup doesn't include this table.

A key-value table for everything that doesn't need its own table. A row belongs to an entity, named by entity_type and entity_id.

ColumnTypeComment
idbigint unsigned NOT NULL AUTO_INCREMENTPrimary key
entity_typevarchar(100) NOT NULLWhat kind of record the row belongs to (see below)
entity_idbigint unsigned NOT NULLThe record's ID, or 0 for site-wide rows
meta_keyvarchar(255) NOT NULLThe key
meta_valuetext NULLThe value. Arrays are stored as JSON
created_attimestamp NULL
updated_attimestamp NULL

Indexes: entity_type, entity_id; entity_type(50), meta_key(140).

Written by: the settings class, short link addresses, campaigns, UTM templates, webhooks, click tracking, Link Coverage, imports from other plugins and the daily maintenance.

The entity types:

entity_typeentity_idmeta_keyWhat meta_value holds
setting0The settings groupThe group's values as JSON
linkThe short link IDaddress: plus an address, and import markersOther addresses of the link, a Simple Redirect's case setting (redirect_any_case) and import bookkeeping
clickThe click IDutm_source, utm_medium, utm_campaign, utm_term, utm_contentThe inbound UTM value, up to 191 characters
affiliateThe affiliate IDautolink_termsCategory and tag IDs for Auto-link only on
campaign0The campaign slugThe Managed campaign's settings
utm_template0The template nameThe template's UTM values
webhook0configThe webhook's settings, with its secret encrypted
webhook_deliveryThe webhook IDThe delivery statusOne queued or finished delivery as JSON
coverage_score0week_{year}_{week}The weekly Link Coverage score, grade and counts
deleted_slug0The slugMarks a slug that a short link was deleted or renamed away from, so it isn't recreated. Cleared when a link takes the slug again

Restore safety copies ​

Before a backup restore replaces an item, it copies the current rows into tables named {table}__lmpsnap. For example, restoring links copies {prefix}link_manager_pro_links into {prefix}link_manager_pro_links__lmpsnap.

Some copies have other names:

  • Restoring settings, clicks or links also copies the matching meta rows into {prefix}link_manager_pro_meta__lmpsnap_setting, __lmpsnap_click or __lmpsnap_link.
  • Restoring categories or tags copies the WordPress terms, term_taxonomy, term_relationships and termmeta rows into tables ending __lmpsnap_categories or __lmpsnap_tags.
  • Restoring posts copies the posts into {prefix}posts__lmpsnap.

When the restore succeeds, it drops the copies of each restored item. When it fails, the plugin puts the rows back from the copies and drops them. A copy stays only when the rollback itself can't finish, and the restore's error message names the tables kept. Uninstall removes any __lmpsnap copy of the eight plugin tables.