Menus, template parts and synced patterns

Since 1.20.0, create-post and update-post can write a block theme’s menus (wp_navigation), template parts (wp_template_part) and synced patterns (wp_block). Before that both abilities were hard-coded to drafts, which left no way to edit a block theme’s menus or header from MCP: these types do nothing until they are published.

Per-type rules

What each ability may do is set per post type by LH_MCP_General_Abilities_Post_Type_Rules, filterable through lh_mcp_general_abilities_post_type_rules. A type with no rule cannot be written at all. Types added through the older lh_mcp_general_abilities_return_writable_post_types filter still work and get the default rule.

Typecreate-postupdate-postExtra
post, page, othersdraft, pendingdraft, pendingDefault rule
wp_navigationdraft, publishdraft, publishFallback guard; navigation blocks only
wp_blockdraft, publishdraft
wp_template_partdraft, publishdraftOverride guard; slug required

The design types need edit_theme_options, and publishing anything needs the type’s publish_posts. Menu content may only hold navigation-link, navigation-submenu, page-list and home-link blocks. A published menu can be revised in place; a published template part or synced pattern cannot, because the change would be live everywhere it is used. Live template parts go through lh-mcp-site-design’s propose, preview and apply flow instead.

Guards

A guard runs only when a write would leave the post published, and a refusal writes nothing.

update-post refuses a date change on anything published or being published, since on a menu the date decides which menu is the fallback.

Audit trail

Every write to a design type is recorded in LH Audit Trail as site_design.post_saved (staff only, kept 730 days), with the action, statuses before and after, the fields changed and replaced_revision_id: a revision holding the content as it was before the write, saved first if one did not already exist. The ability returns the entry as audit_entry_id.