Skip to content

WordPress Editing and Publishing

Gaurav Tiwari edited this page Sep 19, 2026 · 1 revision

WordPress Editing and Publishing

Generated layout files become WordPress content through a manual paste or an authenticated editing workflow. The important distinction is between generating a file, saving a draft and publishing a page.

Manual paste through Code editor

  1. Create or open the intended draft in WordPress.
  2. Switch the block editor to Code editor using its options menu.
  3. Paste the complete generated block markup at the intended location. Preserve unrelated content.
  4. Return to the visual editor. Confirm that the expected native blocks appear and no recovery prompt is shown.
  5. Inspect content, links, images and responsive behavior. Open interactive components.
  6. Save the draft, reload it and check again. Publish only when that is your intended action.

Do not paste the file into a Paragraph or Custom HTML block. Do not automatically accept recovery as a substitute for fixing invalid output; recovery may alter the structure you intended to preserve.

Your account's HTML capabilities and the site's filters can affect SVG and other markup. If content is stripped, investigate permissions and the actual stored content rather than escalating an account's privileges by default.

Authenticated API or MCP workflow

The skill does not provide a server or credentials. Use the site's documented connection and permissions. An assistant needs access to raw stored content, not just rendered HTML.

For a normal page, the relevant read is:

GET /wp-json/wp/v2/pages/ACTUAL_ID?context=edit

Read content.raw. Do not put content.rendered back into the page; it can lose the editor's block structure. Other post types can use different routes.

A safe edit follows this sequence:

  1. Resolve URL, canonical/slug, post type, actual ID and status.
  2. Snapshot current raw content and any separately authorized metadata.
  3. Generate the intended change and run preflight.
  4. Splice the changed section into the original content. Do not regenerate unrelated sections.
  5. Re-fetch immediately before writing; stop on unexpected concurrent edits.
  6. Update only the intended field/record and preserve publication status unless a transition was requested.
  7. Fetch raw content again and compare it with the submitted content.
  8. Check the native editor and the relevant frontend behavior.

Use the helper for transport verification:

python3 skills/generateblocks-layouts/scripts/verify_roundtrip.py \
  --local output/submitted.html --remote output/readback.html

Both files must represent the same intended content or section. A successful comparison proves transport integrity, not visual correctness or a complete accessibility audit.

Keep IDs and authorization separate

A random four-digit scope belongs only to generated block IDs. Never send a write request to a WordPress record merely because its number matches that scope. Draft creation is needed when the task requires a new WordPress record, not as a prerequisite for offline authoring.

Page edits do not implicitly authorize Global Style changes, theme code, metadata changes or replacing a published homepage. Make the requested destination and state explicit in your brief.

If a write fails or times out

Read the record before retrying: the write may already have completed. If stored content changed unexpectedly, compare it with the snapshot and investigate the specific transformation. Restore only the intended affected content when rollback is needed, preserving later legitimate edits.

Detailed route guidance and transport failures: MCP/REST publishing reference.


Back to wiki home · Reference library

Clone this wiki locally