Fix: Hide "View Post" link for non-viewable post types#71356
Fix: Hide "View Post" link for non-viewable post types#71356t-hamano merged 3 commits intoWordPress:trunkfrom
Conversation
|
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 If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Hey @t-hamano, I’d appreciate any feedback or suggestions you might have. |
t-hamano
left a comment
There was a problem hiding this comment.
Thanks for the PR!
I think we need to restore the link again when we "back" from the synced pattern editing screen.
…able to viewable post types
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
useUpdatePostLinkListenerhook to check if the current post type is viewable usingpostType?.viewable. For non-viewable post types, the "View Post" link is hidden usingdisplay: none.Testing Instructions
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