=== Lynkora ===
Contributors: anu771063
Tags: internal links, orphan pages, broken links, seo, site structure
Requires at least: 6.2
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.1.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Find and fix orphan pages, dead ends, broken internal links and hard to reach pages, with link suggestions and old page redirects.

== Description ==

Internal links are how visitors and search engines move through a site. A page nothing links to is almost invisible; a page that links nowhere ends the visit; a link to a deleted or renamed page sends people to an error. Lynkora finds all of these.

= What it finds =

* **Orphans:** published content that no other page, menu, widget or template links to.
* **Dead ends:** content that does not link to any other page on the site.
* **Broken links:** links to trashed, unpublished or deleted content, to a post's old address, through redirects, or to addresses that return "not found" or an error.
* **Hard to reach:** content more than a set number of clicks from the homepage (3 by default), or not reachable by following links at all.
* **Unlinked mentions:** other posts that mention a page's title in their text without linking to it, the quickest links to add for orphaned content.

= What makes it accurate =

* **Every place links live counts:** post and page content, navigation menus, sidebar widgets (Text, Custom HTML and block widgets), synced patterns, and block theme templates, template parts and navigation. A page that is only linked from the main menu is not an orphan.
* **Links are checked, not guessed:** links that match a page are looked up directly; anything else (archives, custom routes) is requested from your own site once to see whether it works.
* **Clear reasons:** "points to a page in the trash", "points to a page that is not published", "uses an old address" and so on, so you know what to do.
* **Always current:** after the first scan, saving content, menus or widgets updates the results immediately. A full background refresh runs daily.

= Fix things from the report =

Every change to content is saved with WordPress's normal revision history, so it can be undone. Anything that removes or unpublishes something asks first.

* **Link suggestions:** each orphan and hard to reach page gets related pages to link from (same categories or tags, the same parent page, shared title words, or text that already mentions it). Each dead end gets pages to link to, starting with pages nothing links to yet, so one link can fix two problems.
* **Add link in one click:** if the suggested page already mentions the title, that mention becomes the link. Otherwise a short "See also" line is added at the end.
* **Link unlinked mentions** in one click from the Unlinked mentions tab.
* **"Link from here"** for hard to reach pages: "A link from About Us would bring this to 2 clicks."
* **Add to menu** for orphans and hard to reach pages.
* **Update links** that use a post's old address or go through a redirect, in content and in custom menu links. Any "#section" part is kept.
* **Remove broken links but keep the text,** one at a time or in bulk. Menu items that point to a missing page can be removed from the menu.
* **Point all links elsewhere:** send every link to a page (or to a missing address) to another page, in content, synced patterns, templates and menus.
* **Restore or publish:** bring a linked page back from the trash with its old status, or publish a linked draft.
* **Bulk actions** on report rows: mark as intentional, move to draft, move to trash.
* **Mark as intentional** for pages that are meant to be unlinked, such as landing pages for ads.

= Old page addresses =

WordPress sends visitors from a post's old address to its new one, but not for pages. Lynkora records the old address whenever a published page, or a page above it, gets a new address, and redirects visitors and old links there. Redirects only happen when the old address would otherwise show "not found", so they never hide a real page. The list on the Old addresses tab shows how often each one is used, and any of them can be removed.

= Optional automatic links =

Both are off by default and are added when a page is shown, so your content is never changed.

* **Related pages** list below posts, pages or other content types you choose.
* **Child page list** below pages that have child pages.

Lynkora counts these links in its reports, so turning them on really does clear orphans and dead ends.

= Track progress =

* **Scan history** with a trend chart on the overview, and the change since the previous scan on each number.
* **Weekly email** (optional) listing only problems that are new since the previous email. No email is sent in a week with nothing new.
* A **Links in / out** column on the Posts and Pages screens.
* **CSV download** of every report.

= WP-CLI =

* `wp lynkora scan` rebuilds the index.
* `wp lynkora report <orphans|dead-ends|broken|deep|mentions|all> [--format=table|csv|json|count]`

= Privacy =

Lynkora makes no requests to other sites and sends no data anywhere. The only requests it makes are to your own site, to check internal addresses it cannot match to content. The optional weekly email is sent with your site's own mail setup to the address you choose.

== Installation ==

1. Install and activate the plugin.
2. Go to **Tools > Lynkora** and click **Scan now**.
3. Work through the Orphans, Dead ends, Broken links and Hard to reach tabs.

== Frequently Asked Questions ==

= Why is a blog post listed as an orphan when it appears on my blog page? =

Lynkora counts links written in content, menus, widgets and templates. On a blog homepage, or the page set as "Posts page", the newest posts are counted as linked from it. Older posts that are only reachable through category, tag or date archives, or by paging back through the blog, are listed, because archive pages are generated, not written. Linking related posts to each other is the best fix.

= What happens to links to a page I renamed? =

From the moment Lynkora is active, it remembers the old address of any published page that gets a new one and redirects visitors there. Links to the old address are listed under Broken links as "Uses an old address", with a button that points them at the new address. Pages renamed before Lynkora was installed are not known, so links to them show as "Page not found".

= Does Lynkora change my content on its own? =

No. Content only changes when you click a fix button, and each change is saved as a revision. The optional Related pages and child page lists are added when a page is shown and are never saved into the content.

= Are links added by blocks or shortcodes counted? =

Links written in content are counted. Links that blocks or shortcodes generate when the page is shown (for example a "Latest posts" block) are not, because they change over time.

= Does it work on large sites? =

Yes. Scans run in small batches with a progress bar, so they never time out, and reports read only the columns they need.

= Who can use it? =

Users who can edit other people's posts (Editors and Administrators). Each fix also checks permission for the exact content it changes: editing a post, publishing it, moving it to the trash, or editing menus. Changing the settings needs an Administrator.

== Changelog ==

= 1.1.0 =
* Link suggestions for orphans, dead ends and hard to reach pages, with one-click "Add link".
* One-click linking of unlinked mentions.
* Remove broken links but keep the text, one at a time or in bulk.
* Point all links to one page at another page, in content and menus.
* Restore a linked page from the trash or publish a linked draft from the report.
* Add pages to a menu from the report.
* Bulk actions: mark as intentional, move to draft, move to trash.
* Old page addresses are remembered and redirected.
* Optional Related pages list and child page list.
* Scan history with a trend chart, and an optional weekly email of new problems.
* Re-reading a page after a change keeps the result of earlier address checks; new addresses are checked in the background a minute later.
* When several trashed pages once had the same address, links are matched to the most recently trashed one.

= 1.0.0 =
* First release.
