Skip to content

Accessing Edit Site via Admin Bar on frontend results in error #72151

@westonruter

Description

@westonruter

Description

I just tried pulling down the latest commits from trunk (611a317) and I ran npm install && npm run build. I then went to the frontend, and I clicked "Edit Site" in the admin bar. The result was an error:

You attempted to edit an item that doesn't exist. Perhaps it was deleted?

This error is the only content shown on the screen.

This happens when clicking on Edit Site from various templates on the frontend:

  • Homepage: /wp-admin/site-editor.php?canvas=edit&p=%2Fwp_template%2Ftwentytwentyfive%2F%2Fhome
  • Page: /wp-admin/site-editor.php?canvas=edit&p=%2Fwp_template%2Ftwentytwentyfive%2F%2Fpage
  • Single: /wp-admin/site-editor.php?canvas=edit&p=%2Fwp_template%2Ftwentytwentyfive%2F%2Fsingle

If, however, I go into the WP Admin and access the Site Editor there, I am then able to Navigate to templates and access the template editors as expected:

  • Index: /wp-admin/site-editor.php?p=%2Fwp_registered_template%2Ftwentytwentyfive%2F%2Findex&canvas=edit
  • Pages: /wp-admin/site-editor.php?p=%2Fwp_template%2F509&canvas=edit
  • Single: /wp-admin/site-editor.php?p=%2Fwp_template%2F288&canvas=edit

Note the difference in the query parameters. It seems the Admin Bar item isn't getting updated to use whatever new query parameters are being used.

When I deactivate Gutenberg, I'm able to use the Edit Site admin bar item again from the frontend.

Related:

Step-by-step reproduction instructions

  1. Activate Gutenberg
  2. Pull the latest commits in trunk (611a317)
  3. Run npm install && npm run build.
  4. Activate the twentytwentyfive theme.
  5. Click on "Edit Site" from the admin bar on the frontend.
  6. See the error.

Screenshots, screen recording, code snippet

No response

Environment info

No response

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

  • Yes

Please confirm which theme type you used for testing.

  • Block
  • Classic
  • Hybrid (e.g. classic with theme.json)
  • Not sure

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Feature] Templates APIRelated to API powering block template functionality in the Site Editor[Priority] HighUsed to indicate top priority items that need quick attention[Type] BugAn existing feature does not function as intended

    Type

    No type

    Projects

    Status

    ✅ Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions