Skip to content

Commit 8d53012

Browse files
committed
Fix View button to only show for pages, not all post types
- Add type === 'page' condition to restrict View button to pages only - Prevents button from appearing on other post types (books, posts, etc.) - Maintains existing behavior for custom links (no button shown)
1 parent 4255fe3 commit 8d53012

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/editor/src/hooks/navigation-link-view-button.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function NavigationViewButton( { attributes } ) {
3131
);
3232

3333
const onViewPage = useCallback( () => {
34-
if ( kind === 'post-type' && id && type ) {
34+
if ( kind === 'post-type' && type === 'page' && id ) {
3535
onNavigateToEntityRecord( {
3636
postId: id,
3737
postType: type,
@@ -41,7 +41,7 @@ function NavigationViewButton( { attributes } ) {
4141
}, [ kind, id, type, onNavigateToEntityRecord ] );
4242

4343
// Only show for page-type links
44-
if ( kind !== 'post-type' || ! id || ! type ) {
44+
if ( kind !== 'post-type' || type !== 'page' || ! id ) {
4545
return null;
4646
}
4747

0 commit comments

Comments
 (0)