# Uninstall and delete data

Uninstall Link Manager Pro without breaking links in your posts, and choose whether your data stays or goes.
Page: https://docs.linkmanagerpro.com/guides/uninstall
Use when someone asks: uninstall link manager pro; delete link manager pro data; remove masked links before uninstall
Intent: How-to

Deactivating Link Manager Pro pauses it and keeps every short link, click and setting. Deleting it removes that data only while **Delete all data when the plugin is deleted** is on. Either way, your short links stop working the moment the plugin is off. To uninstall Link Manager Pro without leaving broken links in your posts, back up, put the original links back, and only then delete the plugin.

## Before you start

- You need an administrator account to deactivate and delete plugins, and to change the **Advanced** settings.
- Putting original links back in your posts takes WP-CLI, WordPress's command line, which many hosts offer over SSH. There's no button for it in the admin. If you can't use WP-CLI, ask your host to run the commands on this page.

## Deactivate or delete: which one do you need?

Deactivate when you want a pause and plan to come back: all data stays and comes back when you activate the plugin again. Delete when you're done with Link Manager Pro. Deleting keeps the data for a reinstall unless you turned on **Delete all data when the plugin is deleted** first.

| | Deactivate | Delete, switch off (the default) | Delete, switch on |
|---|---|---|---|
| Short links, clicks, redirects, affiliates, reports and settings | Kept | Kept in your database | Deleted for good |
| Short links, other addresses and redirects on your site | Stop answering until you activate again | Stop answering | Stop answering |
| Short links written into your posts | Stay, and usually open a 404 page | Stay, and usually open a 404 page | Stay, and usually open a 404 page |
| How to get it all back | Activate the plugin | Install and activate it again | Install it again and restore a backup |

## What happens when you deactivate the plugin?

Deactivating Link Manager Pro under **Plugins** switches its code off and deletes none of your data. While it's off, nothing it does on your site runs, so your short links don't redirect. Activate it again and your links, clicks and settings are all there, but no clicks were recorded while it was off.

While the plugin is deactivated:

- Short links, their [other addresses](https://docs.linkmanagerpro.com/guides/other-addresses) and your [redirects](https://docs.linkmanagerpro.com/features/redirects) stop answering. Visitors get whatever WordPress shows for that address, usually your 404 page. No click or hit is recorded.
- Auto-linked keywords and affiliate disclosures no longer show. Link Manager Pro adds them each time a post is shown, so your posts show the plain words again. The posts themselves don't change.
- Saving a post no longer turns its links into short links.
- Its scheduled tasks are cleared, for example the daily clean-up of old clicks and server backup copies, scheduled Link Health scans and the email digest. Webhook deliveries stop too. Once you activate the plugin again, the recurring tasks are scheduled again.

When you activate the plugin again, setup opens only if it was never finished or skipped.

## What does deleting the plugin remove?

Deleting Link Manager Pro removes its data only when **Delete all data when the plugin is deleted** is on and saved under Link Manager › Settings › Advanced. With the switch off, WordPress removes the plugin's files and every short link, click and setting stays in your database for a reinstall.

WordPress always asks whether you're sure you want to delete Link Manager Pro and its data, whatever the switch says. That question is WordPress's own. Only the switch decides whether the data goes.

With the switch on, deleting the plugin removes:

- The plugin's database tables: short links, clicks, redirects, affiliates, routing rules, Link Health and Link Audit results, webhooks and settings. Safety copies left by a stopped restore go too.
- Every option and temporary value the plugin saved, and its scheduled tasks.
- Your link categories and tags, and the plugin's data on your posts. That data includes the record `wp link-manager-pro unlink` uses to put original links back.
- Link Manager Pro's access permission, from every role ([Access for editors](https://docs.linkmanagerpro.com/guides/access)).
- The GeoIP database and the backup folders in your uploads folder.

What stays, with the switch on or off:

- Your posts as they are. Every short link in them keeps its address, whether masking made it or you inserted it from the editor. With the plugin gone, those addresses usually open a 404 page. The next section shows how to put the original links back first.
- Short links you shared outside your site, for example in emails, social posts, QR codes or on other sites. They usually open a 404 page too, and nothing on your site can change them.
- Backup files you downloaded to your computer.

## Remove short links from your posts before you uninstall

Short links in your posts are written into the post content as addresses like `yoursite.com/link/deal`, so they break once the plugin is gone. The WP-CLI command `wp link-manager-pro unlink` puts the original links back. Run it while the plugin is still active, before you delete anything: it needs the plugin's records to know where each link goes.

Plain `unlink` isn't enough before an uninstall. It keeps short links you added yourself, and it covers only posts where masking was recorded. Use `--scope=all --restore-shortlinks`, as below. The options are explained on [WP-CLI commands](https://docs.linkmanagerpro.com/guides/wp-cli#restore-original-links-with-unlink).

1. Go to Link Manager › Settings › General, turn off **Mask links when saving posts**, then select **Save changes**. While it's on, the next save of a restored post masks its links again.
2. Run a dry run. It changes nothing and counts the posts and links that would change:

   ```bash
   wp link-manager-pro unlink --scope=all --restore-shortlinks --dry-run
   ```

3. Check the counts. On our test site the answer read `Success: Posts would change: 9681. Links restored: 29945, short links kept: 0, unresolved: 290.` If some links can't be resolved, a warning after it says how many, like `Warning: 290 link(s) could not be resolved (deleted link records, no marker). Review manually.` It doesn't say which posts.

::: warning
The next step edits your posts. Back up first under Link Manager › Settings › Backup & restore with **Posts and pages** ticked ([Back up and restore](https://docs.linkmanagerpro.com/guides/backup-restore)). Read the post count in the question before you answer `y`.
:::

4. Run it for real:

   ```bash
   wp link-manager-pro unlink --scope=all --restore-shortlinks
   ```

Masked links go back to the address they had when they were masked. Short links you added yourself are replaced with their current **Destination URL**. A short link you added yourself and later deleted can't be resolved, so its address stays in the post. To find those posts after the real run, search **Posts** and **Pages** in WordPress for your **Short link prefix**, your **Internal link prefix** and your **Affiliate link prefix**, if you set one (`link` and `go` by default, and the affiliate one empty), like `/link/` and `/go/`. WordPress's search looks in the post content too. With WP-CLI, `wp post list --post_type=post,page --s=/link/ --fields=ID,post_title` lists them without changing anything: put your own prefix in place of the default `/link/`, and run it again for the others. Check each match, because the search also finds other text with the prefix in it. Then fix each link by hand.

A real run can also skip posts, for example ones that changed during the run, and a warning gives the count for each cause. What to do about them is on [WP-CLI commands](https://docs.linkmanagerpro.com/guides/wp-cli#if-something-goes-wrong).

What this doesn't reach, so check it yourself:

- Post types other than posts and pages, for example products. Add them with `--post-types`, like `--post-types=post,page,product`.
- Trashed posts and saved revisions.
- Menus, widgets and page-builder data kept outside the post content.
- An old address kept from an import, like `/recommends/deal`. It stays a fix by hand ([General settings](https://docs.linkmanagerpro.com/guides/settings/general#short-link-prefix)).

Restored links go straight to the stored address. They don't get the UTM parameters or [routing rules](https://docs.linkmanagerpro.com/features/conditional-rules) Link Manager Pro added on each click, and clicks on them aren't counted.

Auto-linked keywords need nothing: they're never saved in your posts, so they disappear cleanly with the plugin.

## Uninstall Link Manager Pro step by step

Back up, put the original links back, decide about the data, then deactivate and delete. In this order, your posts are safe before anything is removed.

1. Make a backup. Go to Link Manager › Settings › Backup & restore, select **Backup**, keep **Posts and pages** ticked, then select **Back up now**. Keep the file somewhere other than your site ([Back up and restore](https://docs.linkmanagerpro.com/guides/backup-restore)).
2. Before moving to another site, deactivate the license as described in [Activate your license](https://docs.linkmanagerpro.com/getting-started/license).
3. Put the original links back in your posts, as in [the section above](#remove-short-links-from-your-posts-before-you-uninstall).
4. Note the [redirects](https://docs.linkmanagerpro.com/features/redirects) and short links that must keep working, for example ones you shared in emails. Set them up in the tool you'll use next before you delete the plugin. They stop answering the moment it's off.
5. Decide about the data. To keep it for a reinstall, leave **Delete all data when the plugin is deleted** off and go to step 6.

   To remove it, go to Link Manager › Settings › Advanced and turn on **Delete all data when the plugin is deleted**. A dialog asks first, with a **Back up first** link. Select **Turn on**, then **Save changes**. The switch counts only once it's saved ([Advanced settings](https://docs.linkmanagerpro.com/guides/settings/advanced#delete-all-data-when-you-uninstall-the-plugin)).
6. In WordPress, go to **Plugins** and select **Deactivate** under Link Manager Pro.

::: warning
With **Delete all data when the plugin is deleted** on, the next step removes all short links, clicks, redirects, affiliates, reports and settings for good. Only your backup file can bring them back.
:::

7. On the same row, select **Delete**, then confirm WordPress's question.

## Result

The **Link Manager** menu is gone from WordPress. Open a post on your site and hover over a link you had masked: it points straight to the destination. If you deleted the data, installing Link Manager Pro again starts like a new site. Setup opens, and new-site defaults apply, for example **Anonymize IP addresses** is on ([Install and activate](https://docs.linkmanagerpro.com/getting-started/installation)).

## Uninstall with WP-CLI

`wp link-manager-pro uninstall --delete-data` deletes all plugin data at once, whatever **Delete all data when the plugin is deleted** says, then deactivates the plugin. Without `--delete-data`, it does nothing. Run `unlink` first, as above, because this removes the records it needs.

::: warning
This deletes all short links, clicks, redirects, affiliates, reports and settings on the site for good. It asks for confirmation unless you add `--yes`. Back up first.
:::

```bash
wp link-manager-pro uninstall --delete-data
wp plugin uninstall link-manager-pro
```

The first command lists what it removed, then says `Plugin deactivated.` The second runs WordPress's uninstall for the plugin and deletes its files, like **Delete** on the **Plugins** screen. Its closing message suggests the same `wp plugin uninstall`. Don't use `wp plugin delete` instead: it only deletes the files (WP-CLI's help says so), so WordPress's uninstall step never runs and some of the plugin's records stay in your database.

To keep the data, skip the first command: `wp plugin deactivate link-manager-pro`, then `wp plugin uninstall link-manager-pro`. The switch decides, as on the **Plugins** screen. Every option is on [WP-CLI commands](https://docs.linkmanagerpro.com/guides/wp-cli#remove-all-plugin-data-with-uninstall).

## Uninstall on a multisite network

On a multisite network, Link Manager Pro runs site by site: it can't be network-activated. Each site keeps its own data and its own **Delete all data when the plugin is deleted** switch. When the plugin is deleted, the clean-up goes through every site. It removes a site's data only where that site's switch is on.

A super admin can delete the plugin under Network Admin › **Plugins** while other sites still use it. Deleting removes the files for every site, and posts on a site that never ran `unlink` keep their short links. So on each site that uses it, do this first:

1. Back up ([Back up and restore](https://docs.linkmanagerpro.com/guides/backup-restore)).
2. Put the original links back, as in [Remove short links from your posts](#remove-short-links-from-your-posts-before-you-uninstall), adding `--url=<site address>` to each `unlink` command.
3. Under Link Manager › Settings › Advanced, turn **Delete all data when the plugin is deleted** on or off, as you choose, then select **Save changes**.
4. Deactivate the plugin on that site.

`wp link-manager-pro uninstall --delete-data` also works on one site per run, the one you name with `--url`.

## Details

For technical readers checking the clean-up: names are as they appear in your database and in `wp cron event list`.

| What | Exactly |
|---|---|
| Switch | **Delete all data when the plugin is deleted**, under Link Manager › Settings › Advanced. Off by default, also on new sites. Read from the saved settings when the plugin is deleted, so a change you didn't save doesn't count |
| Tables dropped | `link_manager_pro_links`, `_clicks`, `_affiliates`, `_link_health`, `_redirects`, `_link_rules`, `_link_audit` and `_meta` (with your table prefix), plus each one's `__lmpsnap` restore safety copy |
| Options | Every option, transient and site transient whose name starts with `link_manager_pro_`, `lmp_` or `lmpro_`. On a network, matching network-wide transients go too once any site's data was removed |
| Scheduled tasks | All eleven: `link_manager_pro_purge_clicks`, `_scheduled_health_scan`, `_refresh_sitemap_cache`, `_weekly_coverage_snapshot`, `_email_digest`, `_migration_cron_batch`, `_webhook_drain`, `_webhook_nudge`, `_webhook_purge`, `_address_recheck` and `_cache_trailing_purge`. Deactivating clears the same eleven |
| Categories and tags | Every term of the `link_manager_pro_category` and `link_manager_pro_tag` taxonomies, with its links to short links |
| Post data | The `_lmp_link_map` record of masked links, `_lmp_ai_dismissed_urls` (addresses you dismissed in the AI Link Assistant) and `_lmp_audit_link_targets` (the posts each post links to, for Link Audit). Post content isn't touched |
| Access permission | The `manage_link_manager_pro` capability, from every role. Deactivating removes it from the Administrator and Editor roles only, and activating adds it back |
| Folders | In your uploads folder (usually `wp-content/uploads`): `link-manager-pro/geoip` and every `link-manager-pro/backups-` folder, then `link-manager-pro` itself if it's left empty. A GeoIP folder moved with a code filter, inside `wp-content`, loses only its database file and the `index.php` and `.htaccess` files the plugin wrote there (if unchanged), and goes only if that leaves it empty |
| User data | The `lmp_license_notice_dismissed` user meta record, for every user. On a network, it goes once for the whole network, after any site's data was removed |
| Left behind | Your posts' content and downloaded backup files |
| If the clean-up fails | WordPress still deletes the plugin. Part of the data may already be removed; the rest stays. The reason goes to the PHP error log as `[link-manager-pro] uninstall data clean-up failed:` |
| Deleted outside WordPress | Removing the plugin folder by FTP or a file manager, or with `wp plugin delete`, skips the clean-up. The data stays |

## Get more out of it

- Pause, don't delete, while you're unsure. Deactivating keeps everything and activating brings it back. Your short links don't answer in between, so pick a quiet time for a test, such as a check for a conflict with another plugin.
- Try `unlink` on one post first. `wp link-manager-pro unlink --ids=123 --restore-shortlinks` changes only post 123 (it edits that post, so back up first). Open it and check the links before you run the whole site ([WP-CLI commands](https://docs.linkmanagerpro.com/guides/wp-cli#get-more-out-of-it)).
- Keep your backup file after you delete the plugin. With every item ticked, it lists each short link with its destination and each redirect, which helps when you set them up in another tool. Restored on a reinstall, it brings them back ([Back up and restore](https://docs.linkmanagerpro.com/guides/backup-restore)).
- Moving Link Manager Pro to a new site? You don't need to uninstall to copy your data. Restore a backup there ([Restore a backup on another site](https://docs.linkmanagerpro.com/guides/backup-restore#restore-a-backup-on-another-site)).
- Turn on **Delete all data when the plugin is deleted** as the last thing before **Delete**, not weeks before. While it's on, one wrong click on **Delete** removes everything.

## If something goes wrong

- If your links and clicks were still there after you deleted and reinstalled the plugin, then **Delete all data when the plugin is deleted** was off or wasn't saved. Or the folder was removed outside WordPress, which skips the clean-up. To remove the data now, back up, put your original links back as in [Remove short links from your posts](#remove-short-links-from-your-posts-before-you-uninstall), then follow [Uninstall with WP-CLI](#uninstall-with-wp-cli).
- If short links in your posts lead to a 404 page after you deleted the plugin, then install and activate it again. With the data kept, run `unlink --scope=all --restore-shortlinks` and delete the plugin again. With the data deleted, restore your backup first with **Short links** and **Settings** ticked, so the links and your prefix are back. Then follow [Remove short links from your posts](#remove-short-links-from-your-posts-before-you-uninstall), which starts by turning masking off again.
- If `unlink` reports unresolved links, then their short links were deleted. Find those posts with a search for your prefixes, as in [Remove short links from your posts](#remove-short-links-from-your-posts-before-you-uninstall), and fix the links by hand.
- If **Delete** doesn't show for Link Manager Pro under **Plugins**, then it's still active. Select **Deactivate** first. On a multisite network, only a super admin can delete it, under Network Admin › **Plugins**.

More fixes are on [Troubleshooting](https://docs.linkmanagerpro.com/troubleshooting).

## Related

- [Back up and restore](https://docs.linkmanagerpro.com/guides/backup-restore)
- [Advanced settings](https://docs.linkmanagerpro.com/guides/settings/advanced)
- [WP-CLI commands](https://docs.linkmanagerpro.com/guides/wp-cli)
- [Short links in your posts](https://docs.linkmanagerpro.com/features/link-masking)
- [Troubleshooting](https://docs.linkmanagerpro.com/troubleshooting)
