|
| 1 | +# Spacefast for WordPress |
| 2 | + |
| 3 | +One WordPress plugin, two ways to publish a static site to Spacefast: |
| 4 | + |
| 5 | +- **Static WordPress** uses the free [Simply Static](https://wordpress.org/plugins/simply-static/) |
| 6 | + plugin to generate HTML, CSS, JavaScript, and assets. Spacefast publishes the |
| 7 | + generated directory as an exact snapshot. |
| 8 | +- **Headless CMS** treats WordPress as a public content source. Content changes |
| 9 | + rebuild the connected Astro or other repository project on Spacefast. |
| 10 | + |
| 11 | +## Install |
| 12 | + |
| 13 | +1. In Spacefast, open the Space's WordPress data-source setup and choose |
| 14 | + **Connect WordPress**. |
| 15 | +2. Download [`spacefast-wordpress.zip`](https://github.com/spacefast/wordpress/releases/latest/download/spacefast-wordpress.zip) |
| 16 | + and create the one-time connection. |
| 17 | +3. In WordPress, upload and activate the ZIP, then open **Settings → Spacefast**. |
| 18 | +4. Paste the complete connection, choose a publishing mode, and test it. |
| 19 | + |
| 20 | +The generated credential is scoped to one Space. It can trigger that Space's |
| 21 | +production repository, publish static files to it, and read its version status. |
| 22 | +It cannot edit WordPress, change Space settings, manage domains, or access |
| 23 | +another Space. The secret is stored in a non-autoloaded WordPress option and is |
| 24 | +never displayed after save. A managed host can instead define |
| 25 | +`SPACEFAST_WORDPRESS_API_URL`, `SPACEFAST_WORDPRESS_SPACE_ID`, and |
| 26 | +`SPACEFAST_WORDPRESS_TOKEN` in `wp-config.php`. |
| 27 | + |
| 28 | +## Static WordPress |
| 29 | + |
| 30 | +Install and activate Simply Static, then select **Static WordPress** in |
| 31 | +**Settings → Spacefast**. **Export and publish** starts a full Simply Static |
| 32 | +export. Starting an export from Simply Static's own screen works too. |
| 33 | + |
| 34 | +Spacefast adds a delivery step after Simply Static has generated and delivered |
| 35 | +its files but before cleanup. The step hashes the generated bytes, declares a |
| 36 | +full export as an exact snapshot through Spacefast's normal version API, |
| 37 | +uploads only the files Spacefast requests, waits for activation, and records |
| 38 | +whether that version became live. Partial, update, build, and 404-only exports |
| 39 | +are additive so they cannot accidentally delete omitted site files; run a full |
| 40 | +export after deleting content. Upload transfer is paged and processed one file |
| 41 | +per Simply Static background step so a large upload does not become one |
| 42 | +unbounded WordPress request. |
| 43 | + |
| 44 | +Simply Static remains responsible for crawling WordPress and rewriting URLs. |
| 45 | +Spacefast never reads drafts, WordPress credentials, or the database. Dynamic |
| 46 | +WordPress features still need a static-compatible replacement. |
| 47 | + |
| 48 | +## Headless CMS |
| 49 | + |
| 50 | +Select **Headless CMS** when an Astro or other repository project reads the |
| 51 | +WordPress REST API during its build. Publishing, updating, unpublishing, or |
| 52 | +deleting public REST-visible post types, taxonomy changes, navigation changes, |
| 53 | +media changes, and public user changes schedule a production build. Autosaves, |
| 54 | +revisions, and draft-only transitions are ignored. Multiple hooks in one |
| 55 | +request collapse into one generation. |
| 56 | + |
| 57 | +Delivery uses WP-Cron with a stable idempotency key. Network failures, timeouts, |
| 58 | +rate limits, and server errors retry with bounded exponential backoff. A change |
| 59 | +arriving while a delivery runs remains pending and schedules one successor. |
| 60 | +**Build now** uses the same path immediately. The generic **Build now** action |
| 61 | +in the Spacefast dashboard triggers the same connected production repository. |
| 62 | + |
| 63 | +The plugin sends no post content, title, author, or other WordPress data to |
| 64 | +Spacefast. It sends only the configured public WordPress origin and a request |
| 65 | +to run the server-owned repository settings. |
| 66 | + |
| 67 | +## Operate and remove |
| 68 | + |
| 69 | +The settings page shows the active mode, pending work, delivery status, and the |
| 70 | +last build or version ID. It also provides a connection test and appears in |
| 71 | +Site Health. |
| 72 | + |
| 73 | +**Disconnect** removes the local secret and pending work. Revoke the matching |
| 74 | +WordPress key in Spacefast Developer settings. Uninstall removes all plugin |
| 75 | +options, cron events, locks, notices, and interrupted static-publish state; it |
| 76 | +never deletes WordPress content or Simply Static exports. |
| 77 | + |
| 78 | +## Development |
| 79 | + |
| 80 | +From this directory: |
| 81 | + |
| 82 | +```bash |
| 83 | +./bin/test.sh |
| 84 | +``` |
| 85 | + |
| 86 | +This lints every runtime PHP file, runs dependency-free behavioral tests, builds |
| 87 | +the deterministic installable ZIP in `dist/`, checks the archive, and proves a |
| 88 | +second build produces identical bytes. |
| 89 | + |
| 90 | +Private beta supports WordPress 6.5+, PHP 8.1+, and Simply Static 3.8+ for direct |
| 91 | +static publishing. Activate it per site; network activation is intentionally |
| 92 | +rejected so a credential can never be silently shared across a multisite |
| 93 | +network. |
0 commit comments