=== Tidy Draft Share ===
Contributors: pierreferrolliet
Tags: share draft, preview link, draft sharing, client review, draft preview
Requires at least: 6.0
Tested up to: 6.9
Requires PHP: 8.2
Stable tag: 1.0.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Share unpublished WordPress posts with anyone via secure, expiring preview links — no login required.

== Description ==

**Tidy Draft Share** lets you share any unpublished WordPress post with clients, editors, or collaborators — without publishing it and without giving them a WordPress account.

Generate a secure, time-limited link and send it to anyone. They will see the post exactly as it will look once published: same theme, same layout, same formatting.

= Why Tidy Draft Share? =

Most editorial workflows hit the same wall: *"Can you take a look at this before I publish it?"*. The usual workarounds — copying text into an email, exporting a PDF, or creating a temporary user account — are clunky and error-prone.

Tidy Draft Share solves this with a single click. Create a link, send it, done. The recipient sees a pixel-perfect preview of the post inside your actual theme. When the link expires, access is gone.

= Key features =

* **One-click sharing** — Generate a secure link from the editor sidebar or the posts list, and copy it to your clipboard instantly
* **Flexible expiration** — Choose from 1 hour, 24 hours, 3 days, 7 days, 30 days, or no expiration at all
* **Revoke anytime** — Disable any link immediately with one click; access stops on the spot
* **Multiple links per post** — Create separate links for different reviewers, each with its own expiration and view count
* **View tracking** — See how many times each link has been opened
* **Works everywhere** — Supports posts, pages, and any custom post type (WooCommerce products, portfolio items, etc.)
* **All unpublished statuses** — Drafts, pending review, scheduled, and private posts
* **SEO safe** — Shared previews include a noindex/nofollow meta tag automatically, so search engines never index them
* **Preview banner** — A clear "Draft preview" banner at the top of the page tells the reader the content is not published yet
* **Expired link page** — Visitors see a clean, branded message when a link has expired instead of a confusing error
* **Gutenberg & Classic** — Full sidebar panel in the block editor, classic meta box for older setups
* **Quick share from posts list** — One-click share directly from your posts table, no need to open the editor
* **Clean uninstall** — All data is removed from your database when the plugin is deleted

= Use cases =

* Share a formatted article with a client for approval before publishing
* Let an external editor proofread a draft without creating a WordPress account
* Preview scheduled content with your marketing team or stakeholders
* Send a private post to a specific person without opening it to all logged-in users

= Privacy & security =

Every share link uses a cryptographically secure 32-character token. Token validation uses constant-time comparison to prevent timing attacks. Links are checked on every visit — expired or revoked links return a 403 immediately. No data is sent to external servers; everything stays in your WordPress database.

== Installation ==

1. Upload the `tidy-draft-share` folder to `/wp-content/plugins/`, or install directly from the WordPress plugin directory
2. Activate the plugin through the **Plugins** menu
3. Edit any unpublished post and find the **Share Draft** panel in the editor sidebar
4. Click **Create share link**, choose an expiration, and share the URL

You can also create share links directly from the **Posts** list without opening the editor.

= Configuration =

Head to **Settings → Tidy Draft Share** to:

* Set the default expiration for new links
* Choose which post types support draft sharing

== Frequently Asked Questions ==

= Does the recipient need a WordPress account? =

No. Anyone with the link can view the post — that's the whole point. No login, no account, no friction.

= What post types are supported? =

Posts and pages out of the box. You can enable any registered custom post type (WooCommerce products, portfolio items, etc.) from the settings page.

= Can I create multiple links for the same post? =

Yes. Each link has its own expiration and view count. Handy when you want to share with different people and track access separately.

= What happens when a link expires? =

The visitor sees a clean "This link has expired" page with a link to your homepage. The post remains unpublished and untouched.

= Can I revoke a link before it expires? =

Yes. Click **Revoke** next to the link in the editor sidebar or meta box. Access stops immediately.

= Will shared drafts appear in Google? =

No. Every shared preview includes a `noindex, nofollow` meta tag. Search engines are instructed not to index the page.

= What happens if I publish the post while a share link is still active? =

Visitors who use the share link are automatically redirected to the published permalink.

= Does the plugin slow down my site? =

Not at all. The plugin only runs its logic when a share token is present in the URL. Regular visitors are completely unaffected.

= Is my data safe if I uninstall? =

When you delete the plugin through WordPress, all share link data and settings are removed from your database. Nothing is left behind.

== Screenshots ==

1. **Editor sidebar** — The Share Draft panel in the Gutenberg block editor, with link creation, copy, and revoke controls
2. **Active share link** — A live link showing expiration date, view count, and quick actions
3. **Posts list** — One-click "Share draft" action directly from the posts table
4. **Settings page** — Configure default expiration and enabled post types
5. **Draft preview** — What the recipient sees: the full post with a "Draft preview" banner at the top
6. **Expired link** — The clean error page shown when a link has expired

== Changelog ==

= 1.0.1 =
* Removed the `load_plugin_textdomain()` call; translations are now loaded automatically by WordPress.org since WP 4.6.

= 1.0.0 =
* Initial release
