=== SeedPress ===
Contributors:      gerard
Tags:              developer tools, dummy content, fake data, test data, content generator
Requires at least: 6.3
Tested up to:      6.7
Requires PHP:      8.1
Stable tag:        1.4.2
License:           GPL-2.0-or-later
License URI:       https://www.gnu.org/licenses/gpl-2.0.html

Generate realistic WordPress test content in the background — no timeouts, no Composer, ACF and WooCommerce ready.

== Description ==

SeedPress is a developer tool that generates realistic fake content for WordPress sites without ever hitting PHP timeout limits. Instead of processing everything in a single request, SeedPress creates a background Job for each generation run and processes it in batches via WP-Cron. You can queue up thousands of items and watch the live progress bar in the admin panel while WordPress handles the heavy lifting.

**Every generated item is stamped with a private meta key (`_seedpress_generated`)** so it can be cleanly deleted without touching your real content.

= Content types =

* **Posts** — any public post type, with optional Gutenberg block content, featured images, term assignment, and custom date spread
* **Users** — realistic names, email addresses, bios; any role
* **Taxonomy terms** — any public taxonomy
* **Comments** — spread across existing posts
* **Media attachments** — downloaded from your chosen image provider
* **WooCommerce products** — prices, sale prices, SKUs, stock status (requires WooCommerce)
* **WooCommerce orders** — all order statuses, line items, billing/shipping, spread across the past year (requires WooCommerce)
* **Events** — compatible with The Events Calendar plugin
* **FluentCart products** — prices, stock levels, featured images, linked to FC's custom tables (requires FluentCart)
* **FluentCart orders** — all order statuses, line items, billing addresses, transactions, spread across the past year (requires FluentCart)
* **FluentCRM contacts** — names, emails, phone numbers, addresses, with automatic tag and list assignment (requires FluentCRM)

= Custom fields =

ACF and MetaBox field groups are auto-detected. When you generate a post for a CPT that has field groups registered, SeedPress fills every field with a contextually appropriate value (text, textarea, image, select, checkbox, date, number, email, url, colour, and more). No configuration required.

= SEO integrations =

Yoast SEO and RankMath are auto-detected. Generated posts receive a realistic focus keyword, meta title, and meta description (capped at 155 characters) under the correct meta keys for whichever plugin is active.

= Image providers =

* **Lorem Picsum** — random photos, no key required
* **LoremFlickr** — thematic photos, no key required
* **Placehold.co** — coloured placeholder tiles, no key required
* **Unsplash** — high-quality photos; requires a free Access Key (see FAQ)

= Seed Recipes =

Chain multiple generation steps into a single click. Built-in presets include Blog Launch, Portfolio, WooCommerce Store, and Minimal Dev. Create and save your own recipes from the Recipes tab.

= WP-CLI =

Full CLI support for CI/CD and scripted environments:

`wp seedpress generate post 200 --with-content --assign-terms`
`wp seedpress generate product 50`
`wp seedpress cleanup all --yes`
`wp seedpress recipe run "Blog Launch"`

= No Composer required =

Faker is bundled inside the plugin. Just upload the zip — no `composer install` step.

== Installation ==

1. Upload the `seedpress` folder to `/wp-content/plugins/`.
2. Activate the plugin from **Plugins → Installed Plugins**.
3. Navigate to **Tools → SeedPress**.
4. Choose a content type tab, set your quantity and options, and click **Generate**.

== Frequently Asked Questions ==

= Will it break my real content? =

No. SeedPress only ever deletes items that carry the `_seedpress_generated` meta key, which is set exclusively by this plugin at creation time. Your real posts, users, and media are never touched.

= How do I get an Unsplash API key? =

1. Create a free developer account at [unsplash.com/developers](https://unsplash.com/developers).
2. Create a new application — the free tier allows 50 requests/hour.
3. Copy the **Access Key** (not the Secret Key).
4. In the SeedPress admin, select **Unsplash** as the image provider and paste your key.

The key is stored in `wp_options` on your server and is never exposed in full to the browser.

= Does it work with WP-CLI? =

Yes. Three command groups are registered:

* `wp seedpress generate <type> <quantity> [options]`
* `wp seedpress cleanup [type] [--yes]`
* `wp seedpress recipe list|run <id-or-name>`

CLI generation runs synchronously with a real-time progress bar — no WP-Cron dependency.

= Does it work on WP Engine / hosts that block loopback requests? =

SeedPress calls `spawn_cron()` immediately after scheduling a job so processing starts without waiting for the next page load. On hosts that block loopback HTTP requests this call will silently fail, but WP-Cron will still fire on the next organic page load. Generation will still complete — it just may not start instantly. Use WP-CLI on those hosts for immediate, synchronous generation.

= How do I delete everything SeedPress generated? =

Go to **Tools → SeedPress → Cleanup**. You can delete by type (posts, users, media, etc.) or wipe everything at once. The panel shows a live count before you confirm.

= What happens when I uninstall the plugin? =

`uninstall.php` removes all seeded content, all `seedpress_*` options, and all scheduled cron events. Nothing is left in the database.

= Is it multisite compatible? =

SeedPress operates on the current site's database tables. It has not been tested in a multisite network admin context. Use it on individual sites within a network.

== External Services ==

SeedPress can connect to the following third-party services when you choose them as an image provider. These connections only occur during content generation — SeedPress never sends data to these services automatically.

**Lorem Picsum** (`https://picsum.photos`)
Random photographic images. No account or API key required.
Privacy policy: https://picsum.photos

**LoremFlickr** (`https://loremflickr.com`)
Thematic photographic images. No account or API key required.
Privacy policy: https://loremflickr.com

**Placehold.co** (`https://placehold.co`)
Coloured placeholder images. No account or API key required.
Privacy policy: https://placehold.co/privacy

**Unsplash** (`https://api.unsplash.com`)
High-quality photographic images. Requires a free API Access Key stored in your database.
Terms of service: https://unsplash.com/terms
Privacy policy: https://unsplash.com/privacy
API documentation: https://unsplash.com/developers

No personal data from your WordPress site is sent to any of these services. Requests are image-only fetches with no identifying payload.

== Screenshots ==

1. Posts tab — quantity, post type, status, content, featured image, and date-range options.
2. Live progress bar with time-remaining estimate during generation.
3. Recipes tab — built-in presets and custom recipe builder.
4. Cleanup tab — per-type counts and two-step delete confirmation.
5. Docs tab — built-in reference with collapsible sections.

== Changelog ==

= 1.4.2 =
* Security: user seed roles limited to roles the current user can assign (get_editable_roles); Users tab lists only those roles.
* Security: job get/tick/cancel authorize from the stored job type and require manage_options (no longer default to post/publish_posts).
* Security: recipe create/run/delete require Pro on the server; step quantities capped; Pro-only types blocked without a license.
* Fixed: per-job rollback tracks created IDs and deletes only those items (not all seeded content of a type).
* Fixed: empty role selection falls back to safe defaults instead of a broken array_rand path.
* Accessibility: ProGate no longer leaves focusable controls under aria-hidden; tabs support arrow keys and roving tabindex; destructive actions use confirmation modals; recipe progress bars and cleanup progress improve screen-reader support; reduced-motion respected.

= 1.4.1 =
* Fixed: user cleanup and uninstall safe on WordPress Multisite (remove_user_from_blog / wpmu_delete_user).
* Fixed: license activation when site title is under 3 characters (falls back to site URL as instance name).

= 1.4.0 =
* Added FluentCart product generation — creates products in the correct `fluent-products` post type with rows in `wp_fct_product_details` and `wp_fct_product_variations`. Supports all image providers; falls back to Picsum automatically when no seeded attachments are available, with a guardrail notice in the UI.
* Added FluentCart order generation — inserts orders, line items, billing addresses, and transactions across all FC order statuses (completed, processing, pending, on-hold, failed, refunded, partial-refund). Orders are spread across the past year so dashboards show realistic charts. Line items link to seeded products when available.
* Fixed FluentCRM contact generation — replaced unsupported Faker method calls (`domainName`, `phoneNumber`, `streetAddress`, etc.) with inline alternatives. Contacts are now automatically assigned a random selection of existing tags and lists.
* Improved FluentCRM deletion — switched from per-subscriber ORM calls to a single bulk `DELETE … IN (…)` query; large sets no longer risk a timeout.
* Added batched cleanup for all content types — the cleanup endpoint now accepts a `batch` parameter and returns `{deleted, remaining}`; the frontend loops until `remaining === 0` so even 10,000+ posts are deleted without a timeout.
* Added WooCommerce order generation — creates orders across all WC statuses (completed, processing, pending, on-hold, cancelled, failed, refunded) with realistic weighting, spread over the past year. Line items are drawn from seeded products, falling back to any published product.
* Added FluentCart products, FluentCart orders, FluentCRM contacts, and WooCommerce orders to the Cleanup tab counts and delete options.

= 1.0.0 =
* Initial release.
* Background WP-Cron job pipeline — no timeout limits.
* Generators: post, user, term, comment, attachment, product (WooCommerce), event (The Events Calendar).
* Image providers: Lorem Picsum, LoremFlickr, Placehold.co, Unsplash.
* Auto-detection of ACF, MetaBox, Yoast SEO, and RankMath.
* Seed Recipes with built-in presets and user-created recipes.
* WP-CLI commands: generate, cleanup, recipe.
* Bundled Faker library — no Composer required.
* Built-in documentation tab.

== Upgrade Notice ==

= 1.0.0 =
Initial release.
