Preview
The preview shows the site with a snippet’s unsaved draft running, before the snippet goes live. Open it with the preview control in the workspace header; it opens beside the editor.
What it shows
The preview runs the snippet the selected file belongs to, with every file of that snippet as it stands in the editor, saved or not. Choose a file inside a snippet first; otherwise the pane asks you to.
It opens the site’s home page with a ?sleek_byte_preview=<id> query, and
links to the same site keep that query, so you can browse on. On a request
that carries it:
- only the draft runs: the saved snippets of every source are left out;
- the draft runs even when its
enabledis false, and regardless of its environments, schedule and conditions, so it shows on every page; its contexts and hooks still apply; - PHP prints every error, warning and notice on the page, whatever the site’s
WP_DEBUG_DISPLAYsays.
Keeping it current
The preview reloads when you save, and while it is open the workspace renews it each time your changed PHP passes the check, about a second after you stop typing. A draft with a PHP syntax error keeps showing its last valid state.
How long it lasts
A preview is stored for one hour. Closing the pane or leaving the workspace
deletes it, and an hourly cleanup removes expired previews together with the
temporary files they leave in uploads/sleek-byte-preview.
The draft runs only for the user who opened the preview and for site
managers; anyone else who opens the address sees the site as it is. Safe mode
and SLEEK_BYTE_DISABLE stop drafts too.
Actions_createPreview and Actions_deletePreview create and remove previews
for other tools; see the REST reference.