wp_preview_link
Get a short-lived tokenized PREVIEW URL for a page — WORKS FOR DRAFTS. Use it to see or screenshot unpublished work before publishing: mint the link, then pass preview_url to render_screenshot. Renders through a real WordPress head/footer, so theme CSS, the Elementor kit, per-post Elementor CSS, and custom-code snippets all load — same as the published page, just noindexed (needs Connector >= 0.9.9 for that; an older connector still renders the page but with NO CSS at all — if a preview screenshot looks totally unstyled, that's why, ask the user to update the plugin). Link expires (default 10 min). Requires Connector >= 0.7.6 minimum (on 'connector_update_required', ask the user to update the plugin).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ttl | No | Link lifetime in seconds (60-3600, default 600; with share=true 60-604800, default 259200 = 3 days) | |
| share | No | true = ALSO return share_url, a client-safe link on the site's own domain (<site>/preview/<token>/ — no wp-json, no vendor name, no query string) that lives up to 7 days. Use this whenever a human other than the user will open the link. Connector >= 0.9.17. | |
| post_id | Yes | Page/post ID to preview (drafts allowed) | |
| site_id | Yes | The WordPress site ID |