Directory / plugin

Magic Linking – Internal Links

v0.23.1 · by Carrero

Internal link suggestions in the editor. Link in one click, check that nothing else changes, undo from History. Plus orphan and broken link reports.

About this plugin

Magic Linking suggests internal links while you write, adds the one you choose without touching anything else, and keeps a history so you can undo it. It also reports which of your entries are orphans, under-linked, over-linked or have broken internal links.

It works entirely on your server, with no account, no key and no limits, not even on the number of automatic rules. Artificial intelligence is optional: it only runs if you have connected an AI provider in WordPress (Settings > Connectors) and press Improve with AI in the panel.

In the editor

  • Outbound suggestions: a Magic Linking panel in the block editor (and a box in the classic editor) proposes phrases of the text you are writing that could link to other entries of your site. Each suggestion shows the phrase with the anchor text highlighted in the editor, the destination and the reason.
  • One click to link: press Link and the link is added in the editor itself, on that phrase only. It is part of your unsaved changes until you save, and you can undo it with the Undo button of the card or with the editor’s own undo.
  • Inbound suggestions: the same panel lists other entries whose text mentions the one you are editing and could link to it. Pressing Link writes the link in that other entry, see “How and when it changes your content”.
  • Only the entries and block types where a link can be inserted safely are proposed. Paragraphs and lists are always used; headings, quotes and tables are left alone unless you turn them on in Settings (or a developer allows them with a filter).
  • Dismiss: a suggestion you do not want can be dismissed for good, from either side, and restored with Undo.
  • Improve with AI (optional): with an AI connector (WordPress 7.0 or later), Improve with AI sends the best 20 suggestions to your AI provider in one request. It reorders them, marks the ones it does not recommend, may propose a better anchor text from the same sentence and shows what the request cost. See “AI and your privacy”.

Automatic rules

  • Rules: a screen where you say “this phrase links to this entry”. A rule has a phrase and its variants, a destination (a published entry), how many links to add per entry, whether to link only the first appearance, and an optional gap of one word (so “heat pump” also matches “heat water pump”). You can leave out post types and categories, and pause or edit a rule at any time. There is no limit on the number of rules.
  • Applied by themselves when you publish or update: when a published entry is saved with new text, the rules are applied in the background, not during the save. If the entry is open in someone’s editor, Magic Linking waits and tries again later instead of touching it. Drafts are not linked; they are when you publish them.
  • Applied to what you already have, one entry at a time: Apply to existing entries lists the entries where the rule fits, shows the sentence with the link that would be added and an Add link button for each one, with Undo. There is no “apply to all” button.
  • Quality limits: a rule only adds links. It never removes or changes a link you already have, never links inside a link, and respects your limits: words per link, links to the same target from one entry (Settings > Suggestions) and entries that can use the same anchor text for the same target.
  • A link you undo does not come back: if you undo a link added by a rule, the same rule does not add it again to that entry (unless you edit the rule).
  • WP-CLI: wp magic-linking rules (list, add, delete, scan, apply).

How and when it changes your content

  • Nothing is changed until you press Link on a suggestion, apply a rule to an entry, or publish or update an entry that matches a rule you created. Suggestions never change anything by themselves, and rules only add links.
  • For the entry you have open, the link is inserted in the editor; saving is up to you.
  • For inbound suggestions, the link is written into the other entry on the server. Before saving, Magic Linking checks that the rest of that entry stays exactly as it was: only the link is added. If the check fails, it writes nothing and tells you why. WordPress keeps a revision of the entry as usual.
  • Every change is recorded in History, where you can undo it and redo it; links added by a rule are marked “Automatic rule”. Links you add from the editor panel are listed there too once you save the entry; Magic Linking only records them. Undo removes only that link; if the text around it was edited since, it tells you instead of guessing.
  • An entry that is open in someone’s editor is never modified from the server.
  • Links already written in your content are never removed or rewritten, except to undo a link Magic Linking added or when you fix a broken link from its list.

History

  • Every link Magic Linking changes is listed with who did it, when, where and the anchor text: links from inbound suggestions, from the editor panel (once you save the entry), from rules and fixes from the broken links list.
  • Changes are grouped by entry, newest first. Filter by status, source or title, view by batch, and undo or redo one change, an entry or a whole batch.
  • Undo and redo also with WP-CLI (wp magic-linking history undo --post=<id>).
  • Export to CSV, with no row limit, from Export CSV (what the current filters show) or with WP-CLI (wp magic-linking history export --format=csv). It includes whether the AI recommended each link and with which model.
  • The history is kept 90 days by default; you can choose 30 days, a year or forever.

Report

  • Orphan pages: entries that no other entry links to.
  • Under-linked pages: entries with some inbound links, but fewer than you consider enough (2 by default, you can change it).
  • Over-linked pages: entries with more internal links than one for every 100 words (you can change that too). A short text may always have one link.
  • Broken internal links: links to an entry that is in the trash, is a draft or private, or does not exist. The complete list, with the anchor text and the reason. Fix each one from the list: change its destination to another published entry, or remove the link and keep its text. Magic Linking checks that nothing else in the entry changes, and you can undo it from History.
  • Numbers for every entry: inbound, internal outbound, external and broken links.
  • Add links from the report: Inbound suggestions and Outbound suggestions on each row open a side panel with the suggested sentences. Press Link on the ones you like, one at a time, without opening the editor of the entry; the row updates its numbers and you can undo each link right there or from History.
  • Filters, search by title, sorting, pagination and CSV export of the view you are looking at.

Also

  • WP-CLI: analyse the site, print reports and manage the history from the terminal.
  • Multilingual: the language of each entry comes from WPML, Polylang or, if you use neither, from the site language. Suggestions never link entries of different languages.
  • Made for big sites: the analysis and the index of suggestions are built in the background in small batches with Action Scheduler (bundled), and every entry is updated when you save it. Suggestions for an entry are calculated in a few milliseconds even with thousands of entries.
  • Light: no scripts, no styles and no database queries from this plugin on your public pages.
  • Private: no telemetry, no cookies, no email requests, no notices outside its own screens, and nothing leaves your server unless you press Improve with AI with an AI connector (see “AI and your privacy”).

What it does not do (in this version)

  • It does not check links over the network: a link is “broken” when it points to an address on your own site that leads nowhere, according to WordPress. Links to other sites are counted, not checked.
  • It does not add links by itself, except for the rules you create. Suggestions always need a click of yours.

How links are counted

  • Only the links written inside the content of each entry are counted. Links in menus, widgets, theme templates or blocks that are pulled from somewhere else are not, so your home page or a page that is only linked from the menu can appear as an orphan.
  • Content that a page builder keeps outside the normal post content is not read. If your builder saves rendered HTML in the post content, it is read.
  • Inbound = how many different entries link to this one, counting only links that work. Outbound = internal links to other pages; every appearance counts. Links to the same entry, to files or to mailto: and tel: are not counted.
  • Category, tag, author, date and search pages, the home page and feeds are valid destinations and are never reported as broken.
  • Tracking parameters (utm_*, gclid, fbclid…) and anchors (#…) are ignored when matching a link to an entry.

AI and your privacy

  • Magic Linking has no AI of its own and asks for no key. It uses the AI client and the Connectors screen of WordPress 7.0 or later. On WordPress 6.9 the AI options are turned off and the plugin works as usual.
  • Nothing is sent until you press Improve with AI. Finding out whether a connector exists does not call any model.
  • What is sent, in that one request: the sentence of the entry you are editing with the anchor text marked, and for each of the 20 suggestions the title and a short summary (about 200 tokens) of the destination, made of its title, headings and the beginning of its text. Only clean text: no metadata, authors, email addresses or comments. Private, password-protected and draft entries are never sent as destinations.
  • Where it goes: to the AI provider you configured in Settings > Connectors. If your connector is a local model (for example Ollama), the text does not leave your server.
  • You set a daily limit of tokens (2,000,000 by default; 0 turns AI off). When it is reached, AI pauses until the next day and the suggestions use the built-in engine. Settings > AI shows the connector, the limit and what was used in the last 30 days. Costs are estimates with public list prices; your provider is the one that charges you.

Roadmap

Next: suggestions by meaning with the AI connectors of WordPress, when WordPress offers embeddings.

Support and documentation

Documentation and news: https://magiclinking.com

Questions and bug reports: use the support forum of this plugin on WordPress.org.

External services

Magic Linking does not connect to any external service by itself and has no servers of its own. It has no API keys, no accounts and no telemetry.

The only exception is the optional Improve with AI button, which exists only if you have connected an AI provider to WordPress yourself. Magic Linking does not call any provider directly: it uses the AI client that WordPress 7.0 and later provide (wp_ai_client_prompt()), which sends the request to the provider you configured on the Settings > Connectors screen of your site (wp-admin/options-connectors.php), for example OpenAI, Google, Anthropic or a local Ollama.

  • What is sent: the sentence of the entry you are editing, with the anchor text marked, and, for each of the best 20 suggestions, the title and a summary of about 200 tokens of the destination entry (its title, headings and the start of its text). Only clean text. No metadata, authors, email addresses, comments or private fields. Private, password-protected and draft entries are never sent as destinations. The entry you are editing is sent only because you pressed the button.
  • When: only when you press Improve with AI, once per press. Never in the background, never on page load and never on the public side of your site.
  • To whom: to the provider you configured in Settings > Connectors. Their terms and privacy policy apply to that request, for example OpenAI (https://openai.com/policies), Google (https://policies.google.com) or Anthropic (https://www.anthropic.com/legal). If you use a local model, nothing leaves your server.
  • Control: you choose the provider, you can set a daily token limit (0 turns it off) in Magic Linking > Settings > AI, and a site can veto requests with the wp_ai_client_prevent_prompt filter.

Magic Linking stores the number of tokens used, the provider and the model of each request (not the text) to show your usage in Settings > AI.

Privacy

Magic Linking does not collect personal data and sends nothing anywhere on its own. It stores, in your database, the addresses and anchor texts of the internal links found in your own content, a word index of your entries used for suggestions, counts per entry and a history of the links it has added or fixed, including those you add from the editor panel (which user, when, which entry and the text of the paragraph that changed, so it can be undone). The pairs (entry, target) of the suggestions you dismiss, with the user and the date, so they are not proposed again. It does not set cookies. For the optional AI button it also stores, for each request, the date, the user, the provider, the model, the tokens used and an estimated cost, never the text that was sent; and, for an hour, the result of checking what your AI connector can do. See “External services” for what is sent when you press that button.

Third-party libraries

  • Action Scheduler (WooCommerce) 4.2.x, GPL-3.0-or-later, bundled in vendor/woocommerce/action-scheduler/. Used to run the analysis and the index in the background.

Plugin tags