=== Codesala SEO Content Engine ===
Contributors: bikaskumar, bikaskumar2000
Tags: seo, ai, content-generator, automation, schema
Requires at least: 5.6
Tested up to: 6.9
Requires PHP: 7.4
Stable tag: 1.1.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

The free AI SEO plugin for WordPress: trending keyword research, AI content generator, auto blog scheduler, JSON-LD schema and meta tags — all in one.

== Description ==

**Codesala SEO Content Engine** is a free AI SEO plugin and AI content generator for WordPress. It combines keyword research, AI article writing, on-page SEO optimisation, schema markup and an auto-blog scheduler in one lightweight plugin — and it works on activation without any API key thanks to a built-in zero-config engine that composes articles from real Wikipedia summaries and Google News headlines, with linked citations.

Use it as your **AI writer**, **auto blog plugin**, **keyword research tool**, **JSON-LD schema generator**, and **automated content scheduler** — all from one admin screen. Compatible with Yoast SEO, Rank Math and All in One SEO.

= Why use this AI SEO plugin? =

* **Free forever, no API key required.** The built-in engine uses only public data sources — no signup, no credit card.
* **Real source-backed content, not template fluff.** Every generated article is built from real Wikipedia and Google News data with citation links — useful out of the box.
* **Optional best-in-class AI providers.** Plug in your own free or paid key from OpenRouter, Groq, Cloudflare Workers AI, Google Gemini, Mistral, OpenAI, or Anthropic Claude — auto-fallback handles rate-limits.
* **6 keyword research sources.** Google Trends, Google Suggest, YouTube Suggest, Bing Suggest, Reddit and Wikipedia — all free.
* **Schema markup that ranks.** JSON-LD Article + FAQPage with safe `<script>`-context escaping.
* **Auto blog scheduler with safety brakes.** Daily budget, per-hour throttle, default draft status — protects you from spammy bursts.
* **Compatible with leading SEO plugins.** Auto-detects Yoast, Rank Math and All in One SEO. Native fallback if none is installed.

= Full feature list =

* **AI content generator** with multi-provider fallback chain.
* **Keyword research** from 6 free sources (Google Trends, Google Suggest, YouTube Suggest, Bing Suggest, Reddit, Wikipedia Pageviews).
* **Smart keyword scoring** — long-tail boost, source-weighted, used-keyword tracking.
* **Source-backed article composer** — pulls real Wikipedia summaries + Google News headlines with citation links, even when no LLM is configured.
* **Optional AI providers** — OpenRouter, Groq, Cloudflare Workers AI, Google Gemini, Mistral, OpenAI, Anthropic Claude. All keys user-supplied.
* **Royalty-free images** — optional Pexels / Unsplash with SEO-optimised ALT text.
* **JSON-LD schema** — Article + FAQPage, escaped safely with `JSON_HEX_TAG`.
* **Yoast / Rank Math / AIOSEO compatibility** — focus keyword, meta title and description auto-filled.
* **Auto blog scheduler** — WP-Cron driven, daily budget, per-hour throttle, default draft status.
* **Internal linking** — picks 3 related posts from your archive on every generation.
* **Sitemap pings** — Google + Bing notification on publish (optional).
* **Google Indexing API** support (optional, requires service-account JSON).
* **Built-in analytics** — views, top posts, top keywords. Cached, no GA needed.

= AI providers supported =

| Provider | Tier | Why use it |
| --- | --- | --- |
| Codesala built-in engine | Free, no key | Always-on Wikipedia + News engine |
| OpenRouter | Free tier | DeepSeek-V3, Llama 3.3 free models |
| Groq | Free tier | Fastest Llama 3.3 70B inference |
| Cloudflare Workers AI | Free, 10k/day | Llama, Mistral, Gemma |
| Google Gemini | Free tier | Gemini 1.5 Flash |
| Mistral AI | Free tier | Mistral Small / Medium |
| OpenAI | Paid | GPT-4o-mini, top-quality long form |
| Anthropic | Paid | Claude 3.5 Haiku / Sonnet |

= Realistic strategy =

AI content is risky if you over-do it. Recommended:

* 5–10 high-quality posts/day, not 100.
* Long-tail, low-competition keywords.
* Default status is **draft** so you review before publishing.

== Installation ==

1. Upload the `codesala-seo-content-engine` folder to `/wp-content/plugins/`.
2. Activate the plugin from the **Plugins** screen.
3. Go to **SEO Content → Settings → AI Providers**. The built-in engine works without any setup. For higher-quality output, paste a free API key (Groq, OpenRouter, etc.).
4. Open the **Keywords** tab and click **Fetch trending keywords**.
5. Open the **Generate** tab and create a test post.
6. When you are ready, enable the plugin in **Settings → General** to let the scheduler run automatically.

== Frequently Asked Questions ==

= Does this plugin require an API key? =

No. The built-in engine builds articles from real Wikipedia summaries and Google News headlines through public endpoints. For higher-quality output you can plug in a free key from Groq, OpenRouter, Cloudflare, Gemini, or Mistral. Paid OpenAI / Anthropic are also supported. All keys are user-supplied.

= Will this get my site flagged for spam? =

Auto-publishing too many low-quality articles can cause issues with search engines. The plugin defaults to draft status and a per-hour throttle so you stay in control. Recommended: 5–10 posts per day max.

= Which SEO plugins are supported? =

Yoast SEO, Rank Math, and All in One SEO are auto-detected. If none is active, the plugin outputs its own meta tags and JSON-LD on the front-end.

= Where does the keyword data come from? =

All free public sources: Google Trends RSS, Google Suggest, YouTube Suggest, Bing Suggest, Reddit r/popular, and Wikipedia Pageviews API. See the "External services" section below for details.

== External services ==

This plugin connects to the third-party services listed below. Connections to optional services (LLM providers, image providers, indexing) only happen when the site administrator explicitly configures their own API keys for those services.

= Wikipedia & MediaWiki APIs (always-on, used by the built-in engine) =

This plugin sends the focus keyword to Wikipedia's REST and MediaWiki APIs to fetch the article summary and full plain-text extract used as factual source material in generated articles.

* What is sent: the focus keyword string and the resolved article title.
* When: each time a post is generated using the built-in engine.
* Service: Wikipedia / MediaWiki, operated by the Wikimedia Foundation.
* Terms of use: https://foundation.wikimedia.org/wiki/Policy:Terms_of_Use
* Privacy policy: https://foundation.wikimedia.org/wiki/Policy:Privacy_policy

= Wikimedia Pageviews API (when "Wikipedia Top" keyword source is enabled) =

Used to fetch the previous day's most-viewed Wikipedia articles as a keyword source.

* What is sent: language code and the previous day's date.
* When: when the keyword pool is refreshed.
* Service: Wikimedia Pageviews REST API.
* Terms of use: https://foundation.wikimedia.org/wiki/Policy:Terms_of_Use
* Privacy policy: https://foundation.wikimedia.org/wiki/Policy:Privacy_policy

= Google Trends RSS (when "Google Trends" keyword source is enabled) =

Used to fetch daily trending searches.

* What is sent: country code.
* When: when the keyword pool is refreshed.
* Service: Google Trends.
* Terms of use: https://policies.google.com/terms
* Privacy policy: https://policies.google.com/privacy

= Google Search Suggest, YouTube Suggest, Google News RSS =

Used to fetch keyword autocomplete suggestions, related questions for FAQs, and news article links used as factual source material.

* What is sent: keyword strings, language and country codes.
* When: when the keyword pool is refreshed and each time a post is generated.
* Service: Google.
* Terms of use: https://policies.google.com/terms
* Privacy policy: https://policies.google.com/privacy

= Bing Suggest (when "Bing Suggest" keyword source is enabled) =

Used to fetch keyword autocomplete suggestions.

* What is sent: keyword strings.
* When: when the keyword pool is refreshed.
* Service: Microsoft Bing.
* Terms of use: https://www.microsoft.com/en-us/servicesagreement
* Privacy policy: https://privacy.microsoft.com/privacystatement

= Reddit Public Listings (when "Reddit Trending" keyword source is enabled) =

Used to fetch top posts from r/popular as a keyword source.

* What is sent: nothing (public listing endpoint).
* When: when the keyword pool is refreshed.
* Service: Reddit.
* Terms of use: https://www.redditinc.com/policies/user-agreement
* Privacy policy: https://www.reddit.com/policies/privacy-policy

= Pexels API (only when the user has entered a Pexels API key) =

Used to fetch royalty-free images for generated posts.

* What is sent: the focus keyword and the user's Pexels API key.
* When: each time a post is generated and image fetching is enabled with Pexels selected.
* Service: Pexels.
* Terms of use: https://www.pexels.com/terms-of-service/
* Privacy policy: https://www.pexels.com/privacy-policy/

= Unsplash API (only when the user has entered an Unsplash access key) =

Used to fetch royalty-free images for generated posts.

* What is sent: the focus keyword and the user's Unsplash access key.
* When: each time a post is generated and image fetching is enabled with Unsplash selected.
* Service: Unsplash.
* Terms of use: https://unsplash.com/terms
* Privacy policy: https://unsplash.com/privacy

= OpenRouter (only when the user has entered an OpenRouter API key) =

Optional LLM provider used for generating article content.

* What is sent: the system prompt, the user prompt (containing the focus keyword), the user's OpenRouter API key, the configured model name, and the site's home URL as the HTTP-Referer header.
* When: each time a post is generated and OpenRouter is the active provider.
* Service: OpenRouter.
* Terms of use: https://openrouter.ai/terms
* Privacy policy: https://openrouter.ai/privacy

= Cloudflare Workers AI (only when the user has entered Cloudflare credentials) =

Optional LLM provider used for generating article content.

* What is sent: the system prompt, the user prompt (containing the focus keyword), the user's Cloudflare account ID, API token, and the configured model name.
* When: each time a post is generated and Cloudflare is the active provider.
* Service: Cloudflare Workers AI.
* Terms of use: https://www.cloudflare.com/website-terms/
* Privacy policy: https://www.cloudflare.com/privacypolicy/

= Groq (only when the user has entered a Groq API key) =

Optional LLM provider used for generating article content.

* What is sent: the system prompt, the user prompt (containing the focus keyword), the user's Groq API key, and the configured model name.
* When: each time a post is generated and Groq is the active provider.
* Service: Groq.
* Terms of use: https://groq.com/terms-of-use/
* Privacy policy: https://groq.com/privacy-policy/

= Google Gemini (only when the user has entered a Gemini API key) =

Optional LLM provider used for generating article content.

* What is sent: the system prompt, the user prompt (containing the focus keyword), the user's Gemini API key, and the configured model name.
* When: each time a post is generated and Gemini is the active provider.
* Service: Google Generative Language API.
* Terms of use: https://ai.google.dev/gemini-api/terms
* Privacy policy: https://policies.google.com/privacy

= Mistral AI (only when the user has entered a Mistral API key) =

Optional LLM provider used for generating article content.

* What is sent: the system prompt, the user prompt (containing the focus keyword), the user's Mistral API key, and the configured model name.
* When: each time a post is generated and Mistral is the active provider.
* Service: Mistral AI.
* Terms of use: https://mistral.ai/terms/
* Privacy policy: https://mistral.ai/privacy-policy/

= OpenAI (only when the user has entered an OpenAI API key) =

Optional LLM provider used for generating article content.

* What is sent: the system prompt, the user prompt (containing the focus keyword), the user's OpenAI API key, and the configured model name.
* When: each time a post is generated and OpenAI is the active provider.
* Service: OpenAI.
* Terms of use: https://openai.com/policies/row-terms-of-use/
* Privacy policy: https://openai.com/policies/row-privacy-policy/

= Anthropic Claude (only when the user has entered an Anthropic API key) =

Optional LLM provider used for generating article content.

* What is sent: the system prompt, the user prompt (containing the focus keyword), the user's Anthropic API key, and the configured model name.
* When: each time a post is generated and Anthropic is the active provider.
* Service: Anthropic.
* Terms of use: https://www.anthropic.com/legal/consumer-terms
* Privacy policy: https://www.anthropic.com/legal/privacy

= Google Sitemap Ping (when "Auto ping Google" is enabled) =

Used to notify Google about updated sitemaps after publishing posts.

* What is sent: the public URL of the site's sitemap.
* When: each time a post is published if "Auto ping Google" is enabled.
* Service: Google.
* Terms of use: https://policies.google.com/terms
* Privacy policy: https://policies.google.com/privacy

= Bing Sitemap Ping (when "Auto ping Bing" is enabled) =

Used to notify Bing about updated sitemaps after publishing posts.

* What is sent: the public URL of the site's sitemap.
* When: each time a post is published if "Auto ping Bing" is enabled.
* Service: Microsoft Bing.
* Terms of use: https://www.microsoft.com/en-us/servicesagreement
* Privacy policy: https://privacy.microsoft.com/privacystatement

= Google Indexing API (only when enabled and a service-account JSON key is configured) =

Used to submit individual URLs to Google's indexing service for faster discovery.

* What is sent: the public URL of the published post, signed with the user's Google service-account JWT (via Google's OAuth 2.0 token endpoint).
* When: each time a post is published if "Submit to Google Indexing API" is enabled.
* Service: Google Indexing API + Google OAuth 2.0.
* Terms of use: https://policies.google.com/terms
* Privacy policy: https://policies.google.com/privacy

== Privacy ==

This plugin does not collect or transmit visitor personal data. Data sent to the third-party services listed above consists of: keyword strings entered or selected by the site administrator, language/country codes from settings, and (when applicable) the user's own API keys passed to the corresponding provider. The plugin stores its own data locally in the WordPress options table and a custom `wp_csrm_stats` table (post id, event type, keyword, provider name, sanitized referer, timestamp). No IP addresses, no cookies, and no visitor identifiers are stored.

== Changelog ==

= 1.1.0 =
* **NEW: Business-aware keywords.** A new "Business" sub-tab in Settings auto-detects what your site is about (site name, top categories, product categories, recent topics) and builds a niche profile. You can also override every field manually (products / services, location, target audience). The keyword fetcher then mixes business-relevant seeds straight into the trending pool.
* **NEW: 100/100 SEO Optimizer.** A new top-level admin page lists posts / pages / products with their current score and one-click fix buttons. Fixes 19 weighted signals from the Rank Math / Yoast / AIOSEO content-analysis rules: focus keyword in title (and at start), meta description, slug, intro, subheadings and image alts; keyword density; URL length; word count; external DoFollow + internal links; numbers and power words in title; table of contents injection; long-paragraph splitting; image presence.
* **NEW: Auto-fix on save.** Optional toggle that runs the fixer whenever any supported post is saved.
* **NEW: Per-post SEO meta backup + Revert button.** First fix takes a one-time backup of the original title / content / slug so you can roll back from the SEO Optimizer page.
* **NEW: Generator now produces 100/100 posts.** Newly generated articles are automatically passed through the fixer before publish.
* Settings → 100/100 Fixer sub-tab to choose which post types are eligible, target score, batch size, and whether to allow AI for content rewrites.

= 1.0.0 =
* Initial public release.

== Upgrade Notice ==

= 1.1.0 =
Adds a Business profile (auto + manual) for niche-targeted keywords, and a one-click 100/100 SEO Optimizer that fixes posts / pages / products against Rank Math / Yoast / AIOSEO rules.

= 1.0.0 =
First release.
