=== Content Miner ===
Contributors: contentminer
Tags: content audit, duplicate content, SEO audit, AI search, localization
Requires at least: 6.2
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.5.3
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Mine your WordPress library for overlap, refresh opportunities, localization candidates, and pre-publish collisions.

== Description ==

Content Miner helps editors decide whether to keep, refresh, consolidate, differentiate, create, or localize content.

Version 1.5.3 improves rendered-content analysis, excludes pages that are not meant to earn search visibility from scoring, aligns collision evidence with the analysed page text, and adds bounded page evidence to whole-report AI prompts. Free remains useful without opting in or sending page data to an AI provider. Every recommendation is advisory. Content Miner does not automatically crawl page content. A synchronization may make one request to the site’s own sitemap to classify scoring eligibility. It never deletes, redirects, rewrites, or publishes content.

Features:

* Inventory posts, pages, drafts, and public custom post types.
* Build a resumable, batched content memory for large WordPress libraries.
* Sync changed and newly created content without rescanning every page.
* Review site-wide coverage, exact-copy groups, content families, and recent changes.
* Score SEO, answer, generative-engine, and AI-search readiness separately.
* See recurring site-wide gaps and page-level evidence without a paid API.
* Detect exact copies and likely lexical content collisions across the full memory.
* Optionally detect same-intent, different-words overlap with OpenAI embeddings.
* Connect Google Search Console with the read-only scope.
* Import page clicks, impressions, CTR, and average position.
* Import GA4 landing-page sessions, users, engagement, and key events.
* Flag stale and thin content for review.
* Configure service markets and find localization candidates.
* Check a proposed idea against content already in WordPress.
* Review evidence and confidence for every recommendation.
* Read visitor-facing copy stored by Betheme, Elementor, Divi, and WPBakery.
* Show the detected content source and warn when builder data cannot be extracted safely.
* Manually verify stored extraction against the site's own published pages in resumable batches.
* Record page and collision decisions in a durable operator ledger.
* Copy provider-neutral AI prompts on every plan; optionally run inline explanations on paid plans with a site-owned OpenAI key.
* Track 90-day outcomes and send an optional monthly evidence digest on paid plans.
* Configure a dismissible consultation link, with an off-by-default white-label route for Agency.

== Installation ==

1. Upload the plugin directory to `/wp-content/plugins/` or install its ZIP file.
2. Activate Content Miner through the Plugins screen.
3. Open Content Miner in the WordPress admin menu.
4. Configure service markets if applicable, then run the first scan.
5. Paid users can optionally open Connections, create one Google Web application OAuth client with the displayed callback URL, choose Connect Google, and then select Search Console and/or GA4 properties independently.

== Frequently Asked Questions ==

= Does Content Miner change my content? =

No. It provides recommendations and links to the normal WordPress editor. It does not delete, redirect, rewrite, or publish anything.

= Does similarity prove keyword cannibalization? =

No. Similarity is an investigation signal. Search query, traffic, conversion, backlink, indexing, and business data should be reviewed before acting.

= Does it send content to an AI service? =

Only when an administrator configures an OpenAI API key. Content Miner then sends page titles and text to OpenAI's embeddings API to create similarity vectors. An administrator can also explicitly request explanations for up to 50 semantic collision pairs; that action sends both page texts, truncated to 1,500 words each, to OpenAI's chat completions API. Without a key or operator action, no content is sent for AI analysis. The optional Google connectors use read-only APIs.

= What is the difference between Free and the paid plans? =

Free analyzes up to 500 pages for one site and includes inventory, content memory, lexical collisions, SEO/AEO/GEO/AIO readiness, idea checking, localization candidates, the decision ledger, and provider-neutral Copy AI prompt controls without outcome metrics. Pro is annual-only at $199/year for one site and up to 10,000 pages, and includes every paid feature: semantic analysis, Explain with AI, Search Console and GA4 evidence, 90-day outcomes, monthly digest, and rendered-page verification. Agency is annual-only at $699/year for up to 10 sites and 50,000 combined pages, with everything in Pro plus priority support and a white-label consultation link. Larger estates should contact Corriston Consulting. Paid purchases have a 30-day money-back guarantee.

= Where do I enter a license? =

Open Content Miner, then Account in the WordPress admin menu. Activate or change the license there. If a paid license expires or is deactivated, Content Miner returns to Free behavior without deleting stored plugin data.

= What do Copy AI prompt and Explain with AI do? =

Copy AI prompt is included in Free and copies a provider-neutral prompt containing the displayed titles and evidence; the operator decides whether and where to paste it. Explain with AI is available on paid plans when the administrator supplies a site-owned OpenAI key. It sends the same prompt to the configured provider only after the operator clicks the button.

= How do Google connections work? =

Paid plans use one site-owned Google OAuth connection with read-only scopes. After choosing Connect Google, Search Console and GA4 properties are selected and synchronized independently; GA4 does not require a Search Console property or Search Console sync.

= What are outcomes, the digest, and the consultation link? =

Paid plans can compare recorded decisions with imported evidence after 90 days, with correlation clearly distinguished from causation. The monthly evidence digest is off by default and uses WordPress mail. The consultation link is dismissible; Agency links are off by default, use the agency's own URL and label, and never fall back to Corriston Consulting.

= What happens when a paid license expires? =

Content Miner returns to Free runtime behavior and its Free page ceiling. It does not delete content memory, vectors, imported Google evidence, encrypted settings, or recorded decisions. Reactivating a qualifying license restores access to the retained paid data and workflows.

= Does rendered verification crawl other websites? =

No. It runs only after an administrator starts it and fetches the current site's own published permalinks in batches of 25. It does not run automatically.

= How are Google credentials protected? =

The client secret and OAuth tokens are stored with authenticated encryption derived from the WordPress security keys. Google imports use only `webmasters.readonly` and `analytics.readonly` and run in resumable 1,000-row batches.

= What happens when I uninstall? =

Uninstalling deletes Content Miner's stored analysis, evidence, and encrypted Google credentials. It never touches posts, pages, or media. Deactivating the plugin keeps its stored data so it can be resumed later.

= Do the readiness scores guarantee rankings or AI citations? =

No. They describe observable readiness evidence. Search engines and AI systems do not guarantee crawling, indexing, ranking, inclusion, or citation.

== External Services ==

Content Miner includes the Freemius WordPress SDK for optional account connection, paid-license validation, checkout, and automatic Pro updates. Free users can skip the Freemius opt-in and continue using the plugin without sharing site data. Content Miner does not automatically opt a site into Freemius data collection. When an administrator explicitly opts in, activates a license, opens checkout, or uses the Freemius account screen, the SDK sends the WordPress site URL, plugin version, WordPress/PHP environment details, administrator account details, and license or purchase information needed for that action to Freemius. Freemius use is subject to its terms and privacy policy: https://freemius.com/terms/ and https://freemius.com/privacy/.

Paid licenses are checked by the Freemius SDK. An expired or inactive license disables paid runtime features without deleting Content Miner memory, vectors, Google evidence, settings, or editorial decisions. Pro updates are delivered through Freemius. Placeholder development configuration makes no Freemius request.

Content Miner can optionally send data to OpenAI when an administrator enters an OpenAI API key in the plugin's Connections screen. For each new or changed page, Content Miner sends the page title and up to approximately 4,500 words of page text to `https://api.openai.com/v1/embeddings`. OpenAI returns a numeric embedding created with `text-embedding-3-small` at 512 dimensions. Content Miner stores that vector in the local WordPress database and uses it to compare meaning between pages.

This service is disabled by default. When no OpenAI API key is configured, no page content is sent to OpenAI and Content Miner uses local lexical analysis only. OpenAI API use is subject to OpenAI's terms and privacy policy: https://openai.com/policies/terms-of-use/ and https://openai.com/policies/privacy-policy/.

When an administrator clicks "Explain collisions," Content Miner sends the two page texts for each eligible semantic pair, truncated to 1,500 words per page, to `https://api.openai.com/v1/chat/completions`. The default model is `gpt-4o-mini`. Content Miner requests an advisory consolidate, differentiate, or keep-both verdict and a one-sentence rationale. The action shows the request count first, is capped at 50 pairs, and aligns the pair's advisory recommendation with the returned verdict. It never changes page content or recorded editorial decisions.

Content Miner Pro can connect to Google Search Console after an administrator supplies a site-owned OAuth client and completes Google's consent screen. It requests the `webmasters.readonly` scope and sends the selected site property, page dimension, and 28-day date range to Google's Search Console API. Google returns page-level clicks, impressions, CTR, and average position. The connection is optional and syncs only after an administrator starts it.

Content Miner Pro can use the same site-owned OAuth connection for Google Analytics 4 after an administrator selects a property. It requests the `analytics.readonly` scope and sends the selected property, landing-page dimension, metrics, and 28-day date range to the Google Analytics Data API. The Google Analytics Admin API is used to list properties available to the connected account. Google returns landing-page sessions, users, engagement, and key-event metrics. The connection is optional and read-only.

Google API use is subject to the Google APIs Terms of Service and Google Privacy Policy: https://developers.google.com/terms and https://policies.google.com/privacy. OpenAI API use is described above and is subject to OpenAI's terms and privacy policy.

== Screenshots ==

1. Content overview with library coverage, families, recent changes, and synchronization status.
2. Paginated inventory with recommendations, operator decisions, verification, and content signals.
3. Collision review with exact-copy or lexical evidence and explicit operator controls.
4. Content idea check with an optional target market and an evidence-preview panel.
5. Decision ledger with recorded editorial actions, owners, timestamps, and review notes.
6. Service markets used to identify localization candidates without creating location pages.

== Changelog ==

= 1.5.3 =
* Use verified rendered page text for analysis when stored WordPress fields are incomplete, so builder-based pages are judged from what visitors can see.
* Leave legal, utility, no-search, and unedited WordPress starter pages in the inventory but remove their readiness scores unless an operator includes them in site scoring.
* Align semantic collision checks with the same page text used for readiness, so re-running synchronization updates collision evidence when rendered content changes.
* Add bounded page evidence to whole-report AI prompts with titles, URL paths, readiness scores, top gaps, and connected Search Console metrics, without including page bodies.
* Show a Search Console notice when a connected site needs one synchronization before per-page prompt metrics are current.
* Add exclusions for privacy, terms, search, unsubscribe, sample-page, unedited hello-world, and similar pages so they no longer affect site averages by default.

= 1.5.2 =
* Add a bounded, ranked page-evidence section to whole-report AI prompts with titles, URL paths, readiness scores, top gaps, and connected Search Console metrics, without including page bodies. Re-run Search Console synchronization once after upgrading to include current per-page search metrics.

= 1.5.1 =
* Collision scores can change on sites where rendered content is used; re-run synchronization to re-embed the affected pages, then refresh the full analysis to see current collision scores.

= 1.5.0 =
* Count only pages intended to earn search visibility in site-level readiness scores, exact-copy groups, collision analysis, and recommendations.
* Keep excluded pages in the inventory with their exclusion reasons and an operator control to include them in site scoring.
* Site-level scores may change because fewer pages are counted; individual page evidence remains available.

= 1.4.0 =
* Use rendered page text with navigation, headers, footers, and sidebars removed when verification flags incomplete stored content.
* Scores can change on pages that use a builder or custom fields; re-run rendered verification, then refresh the analysis to apply the change.
* Show the removed navigation, header, footer, and aside word counts on each verified page.
* Nothing is crawled automatically; rendered verification starts only when an administrator requests it.

= 1.3.8 =
* Suppress thin-page recommendations when rendered verification shows that a theme stores substantial content outside standard WordPress fields.
* Show stored and rendered word counts together on flagged verification results.
* Explain plainly when page-builder content cannot be fully read and direct the site owner to review the page before deciding whether it needs work.
* Change only the plugin display name to Content Miner; this rename does not change identifiers, licensing, updates, or behavior.

= 1.3.7 =
* Removed client-specific wording from shipped help and readme text so first-run guidance is generic for every site.
* Kept the same analysis, licensing, search-description evidence, and uninstall behavior as 1.3.6.

= 1.3.6 =
* Correct search-description findings so Content Miner no longer says a description is missing when it is present but too short or too long.
* Tell operators when a report has more possible content collisions than the displayed prompt includes.
* Preserve exact-copy evidence in generated reports and prompts so identical pages are labeled as exact copies, not generic overlap.
* Run complete uninstall cleanup through the Freemius SDK after_uninstall hook and verify generated packages do not contain uninstall.php or deployment secrets.

= 1.3.5 =
* Run complete uninstall cleanup through the Freemius SDK after_uninstall hook in both editions.
* Verify Free and Premium uninstall remove plugin-owned state while preserving posts and media.

= 1.3.4 =
* Adopt the prior display name without changing plugin identifiers or licensing.
* Include the refreshed operator help and static security review.

= 1.3.3 =
* Help content refresh and security review pass.

= 1.3.2 =
* Split public Freemius identifiers from the local-only deployment secret.
* Block any source, Free, or Pro package containing deployment-secret material.
* Add permanent extracted-package regression coverage for the secret boundary.

= 1.3.1 =
* Present Hand-to-AI controls, prompt previews, inline results, and consultation links in responsive dashboard panels.
* Format inline AI Markdown through a strict WordPress HTML allowlist for safer, more readable results.
* Keep per-item AI controls compact inside collision, inventory, and decision views.

= 1.3.0 =
* Add provider-neutral copyable AI prompts to report sections, collision cards, inventory rows, and decision rows.
* Add operator-triggered inline explanations for Pro, Agency, Enterprise, and local Pro development builds.
* Add dismissible, measurable consultation links with Agency-safe white-label routing and an off-by-default Agency setting.

= 1.1.1 =
* Rebuild Free and Pro packages from the reconciled collision-safety and annual-tier source.

= 1.1.0 =
* Add opt-in Freemius licensing with graceful expiry handling and automatic Pro updates.
* Collapse paid licensing into annual-only Pro, Agency, and Enterprise allowances in ingestion and analysis.
* Keep customer content memory and recorded decisions intact when a paid license lapses.

= 1.0.3 =
* Keep collision badges, reasons, and AI explanations consistent across every action type.

= 1.0.2 =
* Report navigation, plain-language labels, and connection-property guidance.

= 1.0.1 =
* Make AI collision verdicts authoritative for the matching advisory recommendation and use non-destructive defaults when no verdict exists.

= 1.0.0 =
* Ship stable Free and Pro packages with WordPress.org directory assets, extracted-package verification, and an operator-reviewed release checklist.

= 0.9.1 =
* Add an opt-in thorough analysis filter that compares every active page when maximum lexical recall matters more than batch cost.
* Sanitize and translate dashboard-facing HTTP failure messages.
* Reduce WordPress Plugin Check warnings with documented fixes and justified annotations.

= 0.9.0 =
* Add manual, resumable verification of stored extraction against published pages.
* Add build-time Free and Pro ZIP packaging with standalone free activation tests.
* Keep Google, semantic analysis, explanations, outcomes, and digest controls out of the free dashboard.
* Complete external-service disclosure, Free/Pro FAQ, and screenshot captions for WordPress.org review.

= 0.8.0 =
* Add a paginated operator decision ledger with page and collision decisions and evidence snapshots.
* Capture optional Google evidence once after 90 days and display before/after deltas as correlation, not causation.
* Add an off-by-default monthly WordPress email digest.
* Add operator-triggered, capped OpenAI explanations for semantic collision pairs without changing recommendations.

= 0.7.1 =
* Add compact lexical signatures so full-library collision audits prepare only likely candidates.
* Scan and unpack each stored vector once per target batch while preserving top-three semantic matches per page.
* Batch vector hash reads and embedding writes during ingestion.
* Preserve v0.7.0 no-key analysis behavior and make exact-copy evidence explicit.

= 0.7.0 =
* Adds optional 512-dimension embeddings with text-embedding-3-small for semantic collision detection.
* Encrypts the optional OpenAI API key and validates it before saving.
* Replaces the 500-page quick audit with a resumable full-memory analysis in batches of 100.
* Reads the 25-row dashboard inventory directly from per-page content memory.
* Labels collision evidence as exact copy, lexical overlap, or semantic similarity.

= 0.6.1 =
* Revokes the Google refresh token before deleting encrypted credentials and stored plugin data during uninstall.
* Fixes GA4 landing-page matching when WordPress uses a subdirectory home URL.
* Uses an atomic, non-autoloaded ingestion lock with stale-lock recovery.
* Resolves Google evidence batches with one post-slug query before permalink fallbacks.

= 0.6.0 =
* Added a pluggable content-extraction layer with standard WordPress, Betheme/Muffin Builder, Elementor, Divi, and WPBakery support.
* Added extraction-source labels to page-level audit signals.
* Added a safe Review fallback when stored builder data is detected but unreadable.
* Bumped the content-memory schema so the next synchronization rebuilds fingerprints from builder content.
* Added builder extraction, sanitization, and extension-filter regression tests.

= 0.5.2 =
* Added Corriston Consulting as the plugin author and product-support destination.
* Added a restrained Corriston Consulting attribution link inside the Content Miner admin footer.

= 0.5.1 =
* Added the Content Miner product mark to the WordPress admin menu.
* Added the full Content Miner logo to the dashboard masthead.
* Aligned the dashboard's core color tokens with the product brand system.

= 0.5.0 =
* Added GA4 property discovery through the Google Analytics Admin API.
* Added 28-day landing-page sessions, users, engagement, and key-event imports.
* Added engagement-verified and full-evidence recommendation confidence.
* Bounded GA4 imports to resumable 1,000-row background batches with a 25,000-row cap.

= 0.4.0 =
* Added site-owned Google OAuth for read-only Search Console access.
* Added authenticated encryption for OAuth client secrets and tokens.
* Added Search Console property selection and a 28-day page evidence sync.
* Bounded large Search Console imports to resumable 1,000-row background batches.
* Added Search verified confidence signals and performance-aware refresh evidence.
* Added a GA4 connector preview for the next integration phase.

= 0.3.3 =
* Limited content collisions to 10 pairs per screen with accessible pagination and result counts.
* Preserved inventory search and page context while reviewing collision pages.

= 0.3.2 =
* Added server-side inventory search across title, type, status, decision, and recommendation evidence.
* Limited inventory rendering to 25 audited pages per screen with accessible pagination.
* Added result ranges, a clear-search action, and a guided no-results state.

= 0.3.1 =

* Added an in-dashboard Help section with first-run instructions.
* Added score and decision explanations, synchronization troubleshooting, safety boundaries, and a first-run checklist.

= 0.3.0 =

* Added independent SEO, AEO, GEO, and AIO readiness scores.
* Added site-wide readiness scores and recurring evidence gaps.
* Added page-level scores and prioritized recommendations to the quick audit.
* Added route-style checks for transit, pricing, and logistics details.
* Kept the scoring engine CMS-neutral behind the WordPress extraction connector.

= 0.2.0 =

* Added persistent per-page content memory and incremental fingerprints.
* Added resumable 100-page ingestion batches for large libraries.
* Added a site-wide Content Overview with coverage and content-family reporting.
* Added exact-copy group counts and a recent-change ledger.
* Kept the detailed similarity audit intentionally limited to 500 recent items.

= 0.1.0 =

* Initial content inventory and decision dashboard.
* Collision detection and idea checker.
* Conservative localization candidates.
