Repository navigation
Description
When a parent page file fails to reconcile, its child page file is still created. The child is made as a new top level page (post_parent 0) at the wrong public address. Any older child page is left alone beside it.
What happens. A parent page file can fail with reconcile_failed. One cause is a page that Blockstudio does not manage already holding the parent's slug. The sync then moves on to the child page file. The child has no page of its own yet, so it is created. Because the parent made no post, the child gets no parent. It lands at /child-page/ and not at /parent-page/child-page/. The failed list names only the parent. The child is not reported.
Affected versions. I read the code on 7.7.14, the latest tag, and on main. page-sync.php is identical in both. I also diffed 7.7.13 against 7.7.14 and page-sync.php and page-discovery.php do not differ. I saw the effect on a real run on 7.7.14.
Steps to reproduce
- In a theme, make two page folders. The child folder sits inside the parent folder.
pages/parent-page/page.json
pages/parent-page/index.php
pages/parent-page/child-page/page.json
pages/parent-page/child-page/index.php
pages/parent-page/page.json:
{ "name": "parent-page", "title": "Parent page", "postStatus": "publish" }pages/parent-page/child-page/page.json:
{ "name": "child-page", "title": "Child page", "postStatus": "publish" }Each index.php holds one line of block markup, for example <!-- wp:paragraph --><p>Hello</p><!-- /wp:paragraph -->.
- Make an ordinary page that Blockstudio does not manage, with the parent's slug:
wp post create --post_type=page --post_title="Old parent" --post_name=parent-page --post_status=publish
- Run the sync:
wp bs pages sync
- List the pages:
wp post list --post_type=page --fields=ID,post_name,post_parent --format=table
Expected. The parent fails, as it does today. The child is refused or held while its parent has no post. No page is created for the child.
Actual. The parent is reported as reconcile_failed. The child is created with post_parent 0 and the slug child-page, so it is public at /child-page/. If an older page already sat at /parent-page/child-page/, it stays untouched and there are now two.
Cause. Three functions in includes/classes/page-sync.php (7.7.14 line numbers):
resolve_parent_id(), lines 1453 to 1484, returns 0 when the parent's page file has made no post. The registry has nopost_idfor it, and the fallback lookup by_blockstudio_page_keyor_blockstudio_page_namefinds nothing.create_post(), lines 849 to 853, setspost_parentonly whenresolve_parent_id()is above 0. With 0 it leavespost_parentout, sowp_insert_post()makes a top level page.has_slug_conflict(), lines 796 to 823, passes the same 0 aspost_parentat line 805. It looks for the child's slug at the top level, finds nothing, and lets the create go ahead.
reconcile() calls these at lines 176 to 181. Nothing there checks that a page with a parent_key has a parent post.
Suggested fix. In reconcile(), before the slug check and the create, return a failed result when the page has a parent_key, its post type is hierarchical, and resolve_parent_id() returns 0. Name the parent in the error. The sync already runs parents first, so the child is simply held until the parent is fixed.
Activity
Hold child page sync when the parent is unavailable [all]
dnnsjsk commentedon Nov 23, 2026
Released in Blockstudio 7.7.15, via #209. Page sync now reports the unavailable parent and skips the child instead of creating it at the top level or moving an existing child. After resolving the parent conflict, run
wp bs pages syncagain.WebUppAdmin commentedon Nov 23, 2026
Thanks for the fix in 7.7.15. Confirmed on a clean install: the orphan child is now reported and skipped, and syncing after fixing the parent places it correctly. Much appreciated.