YUI Preview Token
Issue time-limited preview tokens for headless WordPress setups. Open drafts directly in your frontend URL without long-lived credentials.
Utiliser avec prudence
YUI Preview Token works, but test it on a staging site before relying on it in 2026. Was last updated 6 months ago, and scores 49/100 on our health check.
- Petite base d'utilisateurs (<10Â installations actives)
- Très peu de critiques jusqu'à présent
Comment s'accumule-t-il ?
Côte à côte sur les installations, les mises à jour, les évaluations et le supportTéléchargements quotidiens
Les pics de téléchargement suivent généralement une nouvelle version - chaque site qui met à jour automatiquement compte comme un téléchargement.
Classements
Where YUI Preview Token stands todayWordPress.org Classements de recherche
Position en direct dans la recherche de plugins, Top 100| Mot-clé | Position |
|---|---|
| draft | >100 |
| headless | >100 |
| preview | >100 |
| API REST | >100 |
| token | >100 |
About YUI Preview Token
À partir du Lisezmoi officiel · v1.1.2Description
YUI Preview Token solves the authentication problem in decoupled (headless) WordPress architectures. Application Passwords are a great built-in WordPress feature for this purpose, but they require managing long-lived secrets on the frontend side. This plugin instead issues per-post tokens that grant read access for a configurable period — no persistent secrets required.
The frontend (Astro, Next.js, Nuxt, etc.) receives a preview URL and can fetch the draft content directly via the REST API.
Comment cela fonctionne
- An authorized WordPress user generates a token from the Gutenberg sidebar, Quick Edit panel, or Classic Editor meta box.
- The token is embedded in a preview URL pointing to your external frontend.
- The frontend calls
/wp-json/yui-preview-token/v1/preview?token=…to retrieve the draft content. - The token expires automatically; no manual cleanup needed.
Principales caractéristiques
Token Management
- Generate tokens with expiry presets: 1 hour, 24 hours, 30 days, custom date/time, or no expiry.
- One token per post — issuing a new token invalidates the previous one.
- Tokens are generated with
bin2hex(random_bytes(32))(256-bit CSPRNG). The lookup key stored inwp_optionsis the SHA-256 hash of the raw token, not the token itself — so a database leak does not expose usable tokens directly. - Automatic cleanup of expired tokens via WP Cron (daily).
Editor Integration
- Gutenberg: dedicated panel in the Document Settings sidebar.
- Quick Edit: token controls directly in the post list.
- Classic Editor: meta box in the editor sidebar.
- Copy preview URL to clipboard with one click.
- Update expiry without invalidating the current token.
Admin Settings
- Set the external frontend URL (clicking “Open external preview” navigates directly to this URL).
- Configure allowed CORS origins (multiple, with wildcard support —
https://*.example.com). - Choose the minimum WordPress role required to issue tokens (Subscriber → Administrator).
- Tune rate limiting (requests per time window).
- Optionally permit no-expiry tokens.
Issued Tokens List
- View all active and expired tokens with post title, status, expiry, and issuer.
- Revoke individual tokens or bulk-delete expired ones — all from the Settings screen.
La sécurité
- HTTPS required for the preview endpoint (overridable for local development).
- Per-IP rate limiting with configurable thresholds (default: 30 req / 60 s).
- Role-based access control for token issuance.
- CORS headers only sent for explicitly configured origins; WP core’s permissive echo-back is suppressed.
Referrer-Policy: no-referrerprevents token leakage via referer headers.- Tokens are only valid for
draft,pending, andfuturepost statuses. - Admin-only settings page with defence-in-depth capability checks.
- CSRF protection on all admin actions (nonce verification).
Audit Logging
- Logs token issuance and usage events (post ID, user ID, client IP).
- Logs security events: invalid token attempts, rate-limit violations, capability denials.
- Output goes to
WP_DEBUG_LOGby default; point to a dedicated file withPVT_LOG_FILE.
Internationalisation
- Ships with Japanese (ja) and Simplified Chinese (zh_CN) translations.
- All admin UI strings are translation-ready.
Crochets de développeur
Filtre
yuipt_preview_response_data— Modify the REST API response data before it is sent.
Actes
yuipt_token_issued( int $post_id, int $user_id )— Fires after a token is issued.yuipt_token_used( int $post_id, int $user_id )— Fires when a token is used successfully.yuipt_invalid_token( string $ip )— Fires on an invalid/expired token attempt.yuipt_rate_limit_exceeded( string $ip, string $endpoint )— Fires when rate limit is hit.yuipt_capability_denied( int $user_id, int $post_id )— Fires on a capability denial.
Constants (wp-config.php)
PVT_SKIP_HTTPS_CHECK— Set totrueto disable the HTTPS requirement (development only).PVT_LOG_FILE— Absolute path to a dedicated audit log file.
Use Case
This plugin is designed for headless WordPress setups where a decoupled frontend (e.g. Astro, Next.js, Nuxt, SvelteKit) renders content from the WordPress REST API. It gives content editors a simple, secure way to share draft previews with stakeholders without granting them WordPress accounts or exposing long-lived API credentials.
Installation
- Téléchargez le dossier
yui-preview-tokenÃ/wp-content/plugins/. - Activez le plugin via le menu plugins dans WordPress.
- Go to Settings → YUI Preview Token and set your External Preview URL (the base URL of your frontend).
- Add the allowed CORS origin(s) for your frontend domain.
- Generate tokens from the Gutenberg sidebar, Quick Edit panel, or Classic Editor meta box.
JavaScript Source Code
The files in assets/js/ are compiled and minified bundles. Per WordPress.org guidelines, the human-readable TypeScript source files are available at:
https://github.com/uuki/yui-preview-token/tree/main/plugin/src/assets/js
Build from Source
To rebuild the JavaScript bundles from the TypeScript sources:
- Clone the repository:
git clone https://github.com/uuki/yui-preview-token.git - Install Node.js dependencies:
cd plugin && pnpm install - Compile:
pnpm run build
The build configuration is defined in plugin/tsdown.config.ts. Each bundle in assets/js/ corresponds to one entry point in plugin/src/assets/js/.
Exigences minimales
- WordPress 5.9 or later
- PHP 7.4 ou version ultérieure
- A decoupled frontend that can consume the WordPress REST API
Journal de modifications
1.0.4
- Added “Allow External Token Issuance” setting (disabled by default). When enabled, authenticated users with the required role can issue tokens via the REST API from outside the WordPress admin — designed for CI/CD pipelines and automated workflows.
1.0.3
- Gutenberg: automatically saves the draft before opening the external preview so the frontend always receives the latest content. Classic Editor: added a note prompting users to save before previewing, since unsaved changes are not reflected in the external frontend.
1.0.1
- Preview URL now includes
p=<post_id>&pt=<post_type>&preview=truealongsidetoken=so the frontend can identify the target post and content type directly from the URL.
1.0.0
- Version initiale.
Captures d'écran
Pour les développeurs
Est-ce votre plugin ? Montrez les chiffres.
Ajoutez un badge en direct à votre site, docs ou github readme. Il se met à jour par lui-même - aucun compte n'est nécessaire.
Best YUI Preview Token alternatives
All draft plugins →FAQ
YUI Preview Token: quick answers
Réponses directes, extraites des données en direct WordPress.org.
Source : WordPress.org
Is YUI Preview Token free?
Yes. YUI Preview Token is free to download and use from the official WordPress.org plugin directory.
Is YUI Preview Token safe to use in 2026?
YUI Preview Token works, but test it on a staging site before relying on it in 2026. Was last updated 6 months ago, and scores 49/100 on our health check.
How many websites use YUI Preview Token?
YUI Preview Token is active on <10 WordPress websites and has been downloaded 306 times since it launched in June 2026. It was downloaded 71 times in the last 30 days.
Does YUI Preview Token work with WordPress 7.1?
YUI Preview Token is officially tested up to WordPress 7.0.9, while the latest release is 7.1.5. It may still work, but try it on a staging site first.
What PHP version does YUI Preview Token need?
YUI Preview Token requires PHP 7.4 or higher. Most hosts run PHP 8.x today, so it works on any modern WordPress hosting.
When was YUI Preview Token last updated?
The latest version, 1.1.2, was released on June 15, 2026 (6 months ago).
Who makes YUI Preview Token?
YUI Preview Token is developed and maintained by uukidev.
What are the best alternatives to YUI Preview Token?
The most popular alternatives to YUI Preview Token are Share a Draft (3K+ installs), AMS Post And Page Duplicator (600+ installs) and Publish View (500+ installs).
Propulsé par PageForge
Un modèle et une feuille de calcul. Une vraie page pour chaque recherche.
PageForge transforme chaque ligne d'un CSV en une page WordPress avec son propre titre, URL, SEO et schéma, construit sur la mise en page que vous Déjà conçu. Gratuit sur WordPress.org.
- CSV et XLSX, plus Google Sheets sur les professionnels et les entreprises
- Son propre titre, URL, SEO champs et schéma pour chaque page
- Fonctionne avec l'éditeur de blocs, Elementor, Divi et Avada
- Gratuit sur WordPress.org, pas de carte de crédit
