Skip to content

Posts: Show "View" link for published posts - #1004

Merged
epeicher merged 1 commit into
WordPress:trunkfrom
CookieDarb:fix/view-link-published-posts
Oct 16, 2026
Merged

epeicher merged 1 commit into
WordPress:trunkfrom
CookieDarb:fix/view-link-published-posts

Conversation

@CookieDarb

@CookieDarb CookieDarb commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

What?

Closes #1003

Renders a "View" link next to the title of published posts in the native Posts table view and "View on site" link next to the Open editor button in the story details in writing desk view, matching the behaviour of Pages.

Why?

In the native Posts window table view, published posts did not display a "View" link. In contrast, the native Pages window displayed a quick "View" link, allowing users to view the published page on the front end in a new tab without having to open editor.

This occurred because:

  1. apps/posts/parts/cells/basic.ts gated the link render behind isPages.
  2. apps/posts/parts/query.php omitted link from _fields in openstation_posts_window_default_query_args(), which also caused the Desk view's inspector "View on site ↗" link (apps/posts/parts/desk.ts) to be absent for posts.

How?

  • apps/posts/parts/cells/basic.ts:
    • Removed the isPages condition in buildTitleCell() so any published row with a valid public link renders the "View" action link.
    • Updated the file docblock to mention the "View" link generally rather than only for Pages.
  • apps/posts/parts/query.php:
    • Added link to _fields in openstation_posts_window_default_query_args().
  • docs/hooks-reference.md:
    • Updated the openstation_posts_window_query_args documentation example to include link in the default _fields.
  • apps/posts/posts.test.ts:
    • Added an assertion verifying that a published post in posts mode renders the "View" link with the correct URL.
  • tests/phpunit/tests/postsApp.php:
    • Added link to the default fields tested in test_default_query_args_include_embed_and_fields().

Testing Instructions

  1. Open the native Posts window from the dock or desktop.
  2. In the default Table view, locate any published post.
  3. Observe that a "View" link appears next to the post title in table view.
  4. Click the "View" link and verify that it opens the published post URL in a new browser tab.
  5. In Desk view, select the post and verify that "View on site ↗" also appears in the inspector footer.

Screenshots

Screenshot 2026-10-13 at 1 10 02 PM Screenshot 2026-10-13 at 1 10 26 PM

Use of AI Tools

AI assistance: Yes
Tool(s): Antigravity
Model(s): Gemini
Used for: Reviewing the existing implementation, tracing the root cause, and updatings docs.

Open WordPress Playground Preview

@epeicher
epeicher self-requested a review October 16, 2026 08:34

@epeicher epeicher left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for adding those links @CookieDarb! I have tested the changes, and it works as expected, I can now see those two links. Changes also LGTM!

@epeicher
epeicher merged commit 76a6781 into WordPress:trunk Oct 16, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing "View" link for published posts in native Posts window

2 participants