Skip to content

Conversation

@R1shabh-Gupta
Copy link
Contributor

What?

Closes #71343

Hides the "View Post" link in the admin bar when editing synced patterns to prevent 404 errors.

Why?

When editing a synced pattern via "Edit original", the "View Post" link in the admin bar still appears and leads to a 404 error because patterns don't have public URLs. This creates a confusing user experience.

How?

Updated the useUpdatePostLinkListener hook to check if the current post type is viewable using postType?.viewable. For non-viewable post types, the "View Post" link is hidden using display: none.

Testing Instructions

  1. Open a new playground
  2. Open "Hello World" post in block editor from admin bar or post list in WP-Admin
  3. Disable "full screen mode"
  4. Insert some block(s) and convert them to a synced pattern
  5. Save the post
  6. Enter edit mode for that synced pattern via "Edit original" in tools bar
  7. Verify that the "View Post" button in the admin bar is now hidden
  8. Go back to editing the original post and confirm the "View Post" link is visible again

Screenshots or screencast

Before

Screen.Recording.2025-08-26.at.8.12.45.PM.mov

After

Screen.Recording.2025-08-26.at.8.11.00.PM.mov

@R1shabh-Gupta R1shabh-Gupta marked this pull request as ready for review August 28, 2025 14:08
@github-actions
Copy link

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: R1shabh-Gupta <rishabhwp@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>
Co-authored-by: sabernhardt <sabernhardt@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@im3dabasia im3dabasia added [Type] Bug An existing feature does not function as intended [Package] Edit Post /packages/edit-post labels Aug 28, 2025
@R1shabh-Gupta
Copy link
Contributor Author

Hey @t-hamano,
Could you take a look at the PR when you get a chance? The "View Post" option is now hidden for all post types that are not viewable, using the approach you described in the issue comment.

I’d appreciate any feedback or suggestions you might have.

Copy link
Contributor

@t-hamano t-hamano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

I think we need to restore the link again when we "back" from the synced pattern editing screen.

Copy link
Contributor

@t-hamano t-hamano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@t-hamano t-hamano merged commit 8f9c570 into WordPress:trunk Sep 5, 2025
78 of 79 checks passed
@github-actions github-actions bot added this to the Gutenberg 21.7 milestone Sep 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Edit Post /packages/edit-post [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"View Post" link while editing synced pattern leads to 404

3 participants