Skip to content

Themes: Avoid a missing screenshot request in Theme Details - #14221

Closed
lancewillett wants to merge 1 commit into
WordPress:trunkfrom
lancewillett:fix/theme-details-missing-screenshot
Closed

lancewillett wants to merge 1 commit into
WordPress:trunkfrom
lancewillett:fix/theme-details-missing-screenshot

Conversation

@lancewillett

Copy link
Copy Markdown
Member

Opening Theme Details for a theme without a screenshot requests /wp-admin/undefined and returns a 404. The template has no screenshot image, but the sizing check assigns its missing source to a new Image.

Return before creating that image when no screenshot element exists. Themes with screenshots keep their existing sizing behavior.

Trac ticket: https://core.trac.wordpress.org/ticket/66295

Testing

  • Reproduced the 404 in a browser with a temporary theme without a screenshot.
  • Rebuilt the admin JavaScript and verified that opening the same theme details produced no undefined request.
  • Verified Twenty Twenty-One's screenshot still displayed and loaded successfully.
  • JSHint, JavaScript syntax, whitespace checks, and scoped review passed.

The temporary browser probe and theme were removed; this PR changes only the sizing guard.

Use of AI Tools

Implemented and browser-tested with Codex (GPT-6), including a separate scoped review. Human review is pending.

@lancewillett lancewillett self-assigned this Oct 12, 2026
@github-actions

Copy link
Copy Markdown

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.

Core Committers: Use this line as a base for the props when committing in SVN:

Props lancewillett.

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

@github-actions

Copy link
Copy Markdown

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

@lancewillett

Copy link
Copy Markdown
Member Author

Reviewed at 66d5c80. No open findings.

The change returns early from screenshotCheck() when Theme Details has no screenshot image. Before it, the missing image's undefined source was assigned to a new Image, and the browser requested /wp-admin/undefined.

Checked in a browser against a local build of this branch:

  • Theme with no screenshot: Theme Details opened with no /wp-admin/undefined request. The same steps on trunk produced one, with a 404.
  • Theme with a screenshot: the image still loaded in Theme Details.

For the first case I blanked a bundled theme's screenshot in the page's theme data, instead of installing a theme without one.

CI is green on this head, all 51 checks. One E2E test was retried in one job: login-localize-script.test.js:45, the existing timeout tracked in Trac 66290, not part of this PR.

AI review · claude-opus-5-5

@afercia afercia left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

wporg-sync pushed a commit that referenced this pull request Oct 13, 2026
Return early from `screenshotCheck()` when the theme has no screenshot image. This prevents assigning an undefined source to a new `Image` and requesting `/wp-admin/undefined`.

Preserve the screenshot sizing check for themes with an image.

Developed in: #14221

Props afercia, anupkankale.
Fixes #66295.


git-svn-id: https://develop.svn.wordpress.org/trunk@64329 602fd350-edb4-49c9-b593-d223f7449a82
@github-actions

Copy link
Copy Markdown

A commit was made that fixes the Trac ticket referenced in the description of this pull request.

SVN changeset: 64329
GitHub commit: ba1e8b6

This PR will be closed, but please confirm the accuracy of this and reopen if there is more work to be done.

@github-actions github-actions Bot closed this Oct 13, 2026
wporg-sync pushed a commit to WordPress/WordPress that referenced this pull request Oct 13, 2026
Return early from `screenshotCheck()` when the theme has no screenshot image. This prevents assigning an undefined source to a new `Image` and requesting `/wp-admin/undefined`.

Preserve the screenshot sizing check for themes with an image.

Developed in: WordPress/wordpress-develop#14221

Props afercia, anupkankale.
Fixes #66295.

Built from https://develop.svn.wordpress.org/trunk@64329


git-svn-id: http://core.svn.wordpress.org/trunk@63479 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

2 participants