=== Schema Guru ===
Contributors: jayeshallah
Tags: schema, rich snippets, local business, structured data, seo
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.1.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Schema Guru adds rich schema markup, smart SEO defaults, SEO analysis, and business structured data using JSON-LD.

== Description ==

**Schema Guru** is a WordPress structured data and schema plugin that outputs JSON-LD markup based on Schema.org guidelines. It helps search engines understand your website, organization, business, posts, pages, products, services, events, FAQs, and other supported content types.

You can assign schema types globally or on a per-post/page basis. No coding is required.

**Features:**
- Supports multiple schema types:
  - LocalBusiness and Organization
  - WebSite and WebPage
  - Service
  - Product
  - Restaurant
  - Article / BlogPosting / NewsArticle
  - JobPosting
  - Event
  - Recipe
  - CreativeWork
  - SoftwareApplication
  - Review / rating data where valid values are supplied
  - FAQPage
  - BreadcrumbList
- Post/page-specific schema fields using a custom meta box
- Global organization and local-business settings
- Schema Guru dashboard with local schema coverage and setup status
- Built-in SEO Analyzer for posts and pages
- Editable SEO title, meta description, focus keyword, and canonical URL
- Smart WordPress defaults for SEO title and description
- Reads supported SEO metadata from Rank Math, Yoast SEO, All in One SEO, and SEOPress as editable defaults
- Reads saved Elementor and relevant ACF content for local content analysis and description fallback
- Company logo selector using the WordPress Media Library
- Structured opening hours with multiple day/time ranges
- Social profile settings
- JSON-LD output using WordPress JSON encoding
- Human-readable pretty-formatted JSON-LD in page source
- Sanitized settings, capability checks, nonce verification, and schema-type allowlists
- Lightweight local analysis with no visitor tracking
- Optional OpenAI-powered AI Assistant with BYOK API key
- AI suggestions for SEO title, meta description, focus keyword, schema type, and supported schema fields
- Five-step setup wizard for common configuration
- Roboto-first typography across Schema Guru admin interfaces

**What is Schema Guru?**
Schema markup is structured data that helps search engines understand what a webpage is about. Depending on the page and the available data, valid structured data may make a page eligible for supported rich-result experiences in search engines.

Schema Guru helps you add this information without manually writing JSON-LD code.

**What is a Rich Snippet?**
When any search engine like Google, Yahoo, or Bing crawls your webpage and finds proper information in the right structure, such as organization or local business name, address, phone, page meta description like title, about page description, FAQ info, product photos, star ratings, or offers information, it automatically generates a special search result display called a Rich Snippet.

**Why Rich Snippet?**
A good-looking webpage needs the right Rich Snippet data in the background code to get SEO mileage. Here is Google’s free tool to check the rich results of your page. A JSON-LD structured rich result helps a lot in ranking your page content in Google or any search engine to appear first.

**Supported Schema Types**
Schema Guru supports core website entities such as Organization, LocalBusiness, WebSite, and WebPage, together with page-specific types such as Service, Event, Restaurant, Product, Article, JobPosting, CreativeWork, BlogPosting, NewsArticle, Recipe, FAQPage, Review, and SoftwareApplication.

**SEO Plugin Data Import**
If a supported SEO plugin is active, Schema Guru can read available SEO metadata from Rank Math, Yoast SEO, All in One SEO, and SEOPress and use it as editable defaults. Schema Guru does not write into those plugins. Values manually saved in Schema Guru remain the highest priority.

**Smart SEO Defaults**
When no Schema Guru value or supported SEO-plugin value is available, Schema Guru can use WordPress information such as the page/post title, site name, excerpt, content, and site tagline to provide editable defaults. Saved Elementor and relevant ACF content can also be used as a fallback for local analysis.

**SEO Analyzer**
The post/page editor includes a local SEO Analyzer that checks items such as SEO title, meta description, focus keyword usage, content length, canonical URL, and schema selection. The score is an editing aid and does not guarantee search rankings or rich results.

**Business and Organization Settings**
Schema Guru includes global fields for organization/business information, company logo, address, contact information, geographic coordinates, service area, opening hours, and social profiles. Opening hours can be entered as repeatable day/time ranges and output as structured `OpeningHoursSpecification` data.

**JSON-LD Output**
Schema Guru outputs structured data in JSON-LD format and uses WordPress `wp_json_encode()` for encoding. JSON-LD is pretty-formatted in page source for easier review and debugging.

**External AI Service (Optional)**
When the AI Assistant is enabled and a user clicks Analyze Page with AI, Schema Guru sends the page title, URL, current SEO/schema context, and a limited text extract of the page content to the OpenAI API to generate suggestions. No AI request is made automatically. Use of this feature requires your own OpenAI API key and is subject to OpenAI’s terms and privacy policy.
OpenAI Terms of Use: https://openai.com/policies/terms-of-use/
OpenAI Privacy Policy: https://openai.com/policies/privacy-policy/

**Support**
Support is available through the WordPress.org support forum for Schema Guru.

== Installation ==

1. Upload the plugin files to the `/wp-content/plugins/schema-guru` directory, or install the ZIP through **Plugins > Add New > Upload Plugin**.
2. Activate **Schema Guru** through the Plugins screen in WordPress.
3. Open **Schema Guru > Settings** to configure organization/business defaults.
4. Edit a post or page to configure SEO and schema-specific fields in the Schema Guru meta box.
5. Save or update the page. Schema Guru will output the applicable JSON-LD on the front end.

== Frequently Asked Questions ==

= Do I need to know coding to use Schema Guru? =
No. The plugin provides settings and post/page fields so you can configure structured data without manually writing JSON-LD.

= Will this plugin slow down my site? =
Schema Guru is designed to be lightweight. Its dashboard and SEO analysis use local WordPress data and it does not add visitor tracking.

= Does this plugin add structured data automatically? =
Yes. It can use global settings and post/page values to generate JSON-LD. You can edit the available fields before publishing.

= Can I use multiple schema entities on the same page? =
Schema Guru can output a connected graph containing core entities such as Organization, WebSite, WebPage, and BreadcrumbList together with the selected page-specific schema where applicable. The editor still uses one primary schema type for the page-specific configuration.

= Does Schema Guru modify my SEO plugin? =
No. It only reads supported values as editable defaults. It does not write into Rank Math, Yoast SEO, All in One SEO, or SEOPress.

= Does Schema Guru guarantee rich results or higher rankings? =
No. Structured data can help search engines understand a page and may make eligible content available for supported search features, but search engines decide whether and how those features are displayed.

= How does the optional AI Assistant work, and does it save changes automatically? =
Enable AI Assistant in Schema Guru settings and provide your own OpenAI API key. When you request AI suggestions from a post or page editor, Schema Guru sends a limited extract of that page's content and current SEO/schema context to OpenAI. It can suggest an SEO title, meta description, focus keyword, schema type, and supported schema fields. You can review and apply the suggestions; changes are not saved until you save or update the WordPress post or page. AI requests are optional and may incur charges from OpenAI.

== Screenshots ==

1. Five-step Schema Guru Setup Wizard for business details, identity, optional AI configuration, and finishing setup.
2. Schema Guru Dashboard showing schema coverage, schema type usage, configuration status, and recently updated content.
3. Global organization and local-business settings, including business details, opening hours, and social profiles.
4. Post/page schema settings and SEO Analyzer within the WordPress editor.
5. Human-readable JSON-LD structured data generated in the page source.
6. Optional AI Assistant configuration with enable setting, AI model, and OpenAI API key field.

== Changelog ==

= 1.1.1 =
* Added optional OpenAI-powered AI Assistant using a bring-your-own-key configuration.
* Added user-triggered AI suggestions for SEO title, meta description, focus keyword, schema type, and supported schema fields.
* AI suggestions never automatically overwrite saved Schema Guru or SEO-plugin data.
* Added server-side OpenAI requests through the WordPress HTTP API with nonce and capability checks.
* Added support for SCHEMA_GURU_OPENAI_API_KEY / OPENAI_API_KEY so API secrets can be kept outside the WordPress database.
* Added a five-step setup wizard for common business, identity, and optional AI settings.
* Added Roboto-first typography across Schema Guru admin interfaces.
* Improved input sanitization, output escaping, validation, and compatibility for WordPress 7.x and PHP 7.4 through current PHP 8.x versions.
* Changed SEO/AI page analysis to explicit click-only rendered-page analysis, allowing Elementor, ACF/SCF templates and other builder output to be read without recursively loading large post-meta trees.
* Prevented full post-meta enumeration during editor loading to avoid memory exhaustion on builder-heavy pages.

= 1.1.0 =
* Added Schema Guru dashboard with local schema coverage, schema-type usage, recent updates, setup health, and SEO integration status.
* Added built-in SEO Analyzer for posts and pages.
* Added editable SEO title, meta description, focus keyword, canonical URL, and schema fields.
* Added smart WordPress SEO defaults using the page/post title, site name, excerpt/content, and site tagline where appropriate.
* Added editable SEO data imports from supported Rank Math, Yoast SEO, All in One SEO, and SEOPress metadata.
* Added SEO analysis support for WordPress and page-builder content.
* Added schema-type-aware admin fields and conditional controls for supported schema types.
* Added improved Organization and Local Business settings with WordPress smart defaults.
* Added Media Library company-logo selection and preview.
* Added structured opening hours with repeatable day/time ranges and 12/24-hour preference.
* Added social profile settings and structured business information.
* Improved Organization, WebSite, WebPage, BreadcrumbList, canonical, and main-entity graph output.
* Added readable pretty-formatted JSON-LD output while retaining safe WordPress JSON encoding.
* Improved sanitization, validation, escaping, nonce checks, capability checks, schema allowlists, and URL handling.
* Improved compatibility with current WordPress and modern PHP versions.
* Various dashboard, editor, performance, and stability improvements.

= 1.0.0 =
* Initial release of Schema Guru.
* Added LocalBusiness, Service, Product, Article, JobPosting, Event, Recipe, SoftwareApplication, Review, and FAQPage schema support.
* Added JSON-LD structured data output.

== Upgrade Notice ==

= 1.1.1 =
Adds the optional AI Assistant, five-step setup wizard, Roboto-first admin typography, and security/compatibility improvements.

= 1.1.0 =
Major update with a new dashboard, SEO Analyzer, smart SEO defaults, supported SEO-plugin imports, improved schema generation, business settings, structured opening hours, security improvements, and readable JSON-LD output.

== License ==

Schema Guru is licensed under the GPLv2 or later.