=== Hostious Internal Link Builder Pro ===
Contributors: hostious
Tags: internal links, link building, seo, broken links, orphaned posts
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.2.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Internal link suggestions while you write, auto-linking rules, orphaned-post and broken-link reports, click tracking and optional AI (own key).

== Description ==

Hostious Internal Link Builder finds the internal links your site is missing and helps you add them in seconds – from the post editor, from the reports, or automatically through keyword rules. Everything runs on your own server; nothing is sent to Hostious or anyone else.

**What it does**

* **Internal link suggestions** – inbound and outbound suggestions in the post editor and on term pages, with sentence editing, anchor selection and one-click insert. Bulk-approve the strong suggestions with a preview before anything is written.
* **Auto-linking** – keyword rules that link automatically, in bulk or on save, with priorities, limits and restrictions per post type, category and date. CSV import, and JSON export/import of all rules.
* **Orphaned posts** – a report of posts without inbound links and the fastest way to fix them.
* **Broken links** – scheduled checks of internal and external links, with one-click replacement, ignore and (optionally) AI-assisted replacement URLs.
* **Click tracking** – which internal links visitors actually click, per post and per link. Click events can be forwarded to AnalyticsWP.
* **URL changer** – change a URL everywhere on the site, with history and undo.
* **Visual sitemaps** – an interactive map of how your content links together.
* **Domains report** – every external domain you link to, how often, and with which attributes.
* **Target keywords** – from Google Search Console (your own OAuth client), Yoast SEO, Rank Math, All in One SEO, custom lists, and "Searched on site" phrases from Hostious AJAX Search – so suggestions use the words people really search for.
* **Related posts** – a styled related-posts block under the content, automatic or hand picked.
* **AI, optional** – runs on your own OpenAI API key: post summaries, embeddings, AI-powered suggestions, "Fix with AI" for orphaned posts and link coverage, and web-search assisted broken-link repair. Live mode or Batch API, with a cost overview in DKK. No credits, no subscription.
* **Weekly link-health e-mail** – a short summary of broken links, orphaned posts and new suggestions, in Danish or English.
* **Danish and English UI** – switch the plugin screens with one click in the app bar (per user).
* **WP-CLI** – `wp hostious-link status|scan|queue|lang|reset-queue|export|import`.
* **Settings & rules export/import** – save a site profile as JSON and set the next site up from it, from the Maintenance tab or WP-CLI.

**Page-builder support**

Links are found and inserted in the content of Gutenberg, the Classic editor, Breakdance, Elementor, Divi, Oxygen, Beaver Builder, Kadence, Thrive Architect, WPBakery, Bricks, YOOtheme, Enfold, Avada, Cornerstone, Goodlayers, Muffin, Themify and ACF fields.

**Privacy**

The plugin never phones home. There is no licence check, no telemetry, no remote code and no external service other than the ones you connect yourself (your OpenAI key, your Google Search Console client).

== Installation ==

1. Upload the plugin folder to `/wp-content/plugins/` or install it from the Plugins screen.
2. Activate it.
3. Go to **Link Builder → Setup** and run the first link scan. On a large site this takes a few minutes; it continues in the background.
4. Optional: add your OpenAI API key under **Settings → AI**, connect Google Search Console under **Settings → Advanced**, and pick a language with the DA | EN switch in the app bar.

If Link Whisper is active, it is deactivated on activation and its data (reports, rules, target keywords, clicks, settings) is taken over – no re-scan needed.

== Frequently Asked Questions ==

= Does it phone home? =

No. The plugin makes no requests to Hostious or any third party on its own. The only outgoing requests are the ones you set up: the OpenAI API with your own key, Google Search Console with your own OAuth client, and the broken-link checker, which fetches the URLs your content links to.

= Do I need an AI subscription? =

No. AI features are optional and use your own OpenAI API key. You pay OpenAI directly; the plugin shows an estimate of the cost per feature.

= Does it work with my page builder? =

Yes for Gutenberg, the Classic editor and the builders listed above. Content stored in post meta (ACF and most builders) is scanned and linked like regular content.

= Will it slow my site down? =

Scans and link checks run in the background in small batches. On the front end the plugin adds one small script for click tracking (which you can turn off) and nothing else.

= Can I move my settings to another site? =

Yes. **Settings → Maintenance → Export settings & rules** downloads a JSON file; import it on the other site. API keys and credentials are never part of the file. The same is available with `wp hostious-link export` and `wp hostious-link import`.

= Is it a fork? =

The linking engine is derived from Link Whisper (GPL-2.0-or-later). Hostious has removed all licensing, telemetry and vendor services and added the features listed above.

== Screenshots ==

1. Dashboard – link health, broken links, orphaned posts and link coverage at a glance.
2. Link suggestions in the post editor with anchor selection and one-click insert.
3. Auto-linking rules.
4. Broken links report.
5. Visual sitemap.
6. Settings with the DA | EN switch and the export/import of settings and rules.

== Changelog ==

= 1.2.1 =
* Fixed: "Searched on site" keywords now read the search log of Hostious AJAX Search 3.2+ (hostious_as_stats) together with the older log table, so searches after the 3.2 update are included.
* Fixed: links to the site's own pages were reported as broken when the site's firewall or bot protection answered the server's own check with 401/403/429/503. A link to a published page on the same site is no longer counted as broken in the report, the dashboard, the weekly e-mail or `wp hostious-link status`. Missing pages are still reported.

= 1.2.0 =
* New: publish reminders in the block editor, classic editor and Elementor – before publishing, Link Builder asks whether the post should link out to more relevant pages and whether related pages should link back; after saving it shows inbound and outbound link counts. Can be turned off per site or per user (Settings → Advanced → Notifications).
* New: suggestion scoring rebuilt around one match score, using word usage across the whole site (bodies and titles) and the sentence around each link. One suggestion per source/target pair; text on both sides of existing links is checked.
* New: keyword and page search bars in the suggestion panels, page-type labels on suggestion cards.
* New: Clicks report redesigned – 30-day tiles, By Post / By Link tabs, filters, CSV export, click details with chart, click log, date range, per-click delete and IP erase.
* New: AI agent access (MCP) – Claude, ChatGPT and other AI apps can read reports, find and propose links and start Fix with AI runs; every change waits for your review. Sign-in (OAuth with PKCE) or API key, rate limited. Off by default (Settings → AI).
* New: "Don't create autolinks in money pages" (on by default), "Export selected" on the AI Links report, "Clear AI Summary Data", confirmation before link and broken-link scans, URL Changer "rules per page", items per page up to 500.
* Improved: AI runs (own OpenAI key): post summaries and summary relations in the run, rebuilt keyphrase selection, AI anchors keep their target, stored suggestions stay within the selected post types.
* Improved: notification e-mails that fail are retried once a day and only to the addresses that did not get it.
* Security: hardening from Link Whisper 4.0.5 (permission checks, query hardening, CSV formula escaping on export) on top of the 1.1.4 checks.
* Fixed: the Danish screen translation could change words inside suggestion sentences, so editing an anchor could write Danish words into a post. Post text is now never translated.
* Fixed: a format error on PHP 8 in the AI run report, a missing method in inbound AI suggestions, duplicate Dashboard/Settings links on the Plugins screen, several untranslated messages.
* PHP 8.5: whole plugin and bundled libraries checked; remaining curl_close() calls removed. Still runs on PHP 7.4.
* Removed: more old upstream code and settings (licensing, credits, tours, telemetry notices); leftover options are deleted on upgrade.
* Based on Link Whisper 4.0.7 (GPL). Database version 1.75 – the update runs automatically.

= 1.1.4 =
* Security: every action protected by the plugin's nonce now also requires a user who can edit posts, so customers and subscribers cannot trigger them.
* Security: 16 admin actions that had no nonce or capability check (e.g. continuing the inbound link insert, adding links to the ignore list, search and wizard helpers) now require an editing role. Inserting pending links only touches posts and terms the current user may edit.
* Updated: Moment.js 2.30.1 (2.29.2 had a known ReDoS fix in 2.29.4).
* PHP 8.5: removed deprecated curl_close() calls.
* Fixed: opening the click details page without a valid post stopped with a fatal error; it now returns to the click report.
* Tested with WordPress 7.1.

= 1.1.3 =
* Fixed: the broken link report no longer lists placeholder addresses from guides and code examples (example.com, ditdomaene.dk, eksempel.dk, dinshop.dk, firmanavn.com and reserved .test/.example/.invalid names). More can be added with the hilb_placeholder_hosts filter.
* Fixed: a link with an empty, escaped href was saved as a "Link Format Error" without a URL; it is now reported as a link without a URL.

= 1.1.2 =
* Fixed: the WordPress dashboard widget's status badges overlapped the numbers (badge now sits in the row next to the value); the widget got a small title row.

= 1.1.1 =
* Fixed: cron schedule labels were translated before `init`, which triggered WordPress' "translation loading too early" notice on Danish sites when another plugin scheduled an event at load time.
* Fixed: PHP 8.4 deprecation in the bundled token counter (implicit nullable parameter).

= 1.1.0 =
* New: AI cost overview in DKK per feature and per month, with a monthly budget.
* New: live AI mode – suggestions, summaries and embeddings without the OpenAI Batch API.
* New: export and import of settings and auto-link rules as JSON (Settings → Maintenance) and with `wp hostious-link export|import`.
* New: weekly link-health e-mail in Danish or English with a new layout.
* New: internal-link click events are sent to AnalyticsWP when it is installed.
* New: "Searched on site" target-keyword source from Hostious AJAX Search.
* New: Breakdance editor integration – suggestions and link insertion inside the Breakdance builder.
* New: bulk-approve strong suggestions with a preview before insertion.
* New: Domains, Clicks and Sitemaps reports in the new layout.
* Changed: WordPress.org-ready readme, plugin assets and a GPL audit of all bundled libraries.

= 1.0.0 =
* New: Hostious app bar with grouped navigation (Dashboard, Reports, Auto-Linking, Target Keywords, URL Changer, Setup, Settings) and the Hostious design on every screen.
* New: Danish and English with a DA | EN switch per user; full translation of the plugin screens.
* New: takeover of an existing Link Whisper install – same data, no re-scan needed.
* New: Google Search Console connects through your own Google OAuth client (Settings → Advanced); no third-party proxy.
* New: "Fix with AI", AI link suggestions and broken-link repair with web search run directly against OpenAI with your own API key.
* New: WP-CLI commands and a CSV export of a post's links.
* Changed: all licensing, AI credits, subscriptions, vouchers, affiliate hub, telemetry/phone-home, promo popups, tours, support widgets and vendor links removed.
* Changed: settings reorganised into eight tabs (General, Content scope, Domains & URLs, Linking rules, AI, Related posts, Advanced, Maintenance).
* Changed: the plugin is about 60 % smaller (unused libraries, duplicate templates and assets removed); fewer scripts and styles per screen.
* Fixed: external links view used an undefined variable; orphan report stylesheet never loaded (handle collision); menu screen IDs changed when the issue counter was shown; queue debug view on an empty queue.

== Upgrade Notice ==

= 1.1.0 =
Adds settings/rules export-import, live AI mode with a cost overview, the weekly link-health e-mail and Breakdance support. No database changes; existing data and settings are kept.

= 1.0.0 =
First Hostious release. Replaces Link Whisper and takes over its data on activation.
