Make WordPress Core

Opened 5 months ago

Last modified 9 days ago

#64729 new defect (bug)

Missing “Live Preview” button for block themes after installation on the “Add Themes” screen

Reported by: huzaifaalmesbah Owned by:
Priority: normal Milestone: Future Release
Component: Themes Version: 6.9
Severity: normal Keywords: has-patch has-test-info has-screenshots early
Cc: Focuses:

Description

On the Add Themes screen (wp-admin/theme-install.php), when installing themes from search results or browsing via tabs/filters, the first theme card does not display the "Live Preview" button after installation completes.

Only the "Activate" button is shown for the first installed theme card. All subsequent installed theme cards correctly display both "Activate" and "Live Preview" buttons.

This issue occurs consistently across:

  • Search results
  • Popular tab
  • New tab
  • Block Themes tab
  • Feature Filter results

Steps to Reproduce:

  1. Log into the WordPress administration dashboard.
  2. Navigate to Appearance → Themes → Add New Theme.
  3. Use any of the following:
    • Search for a keyword (e.g., "hello"), OR
    • Click the Popular tab, OR
    • Click the New tab, OR
    • Click the Block Themes tab, OR
    • Apply any Feature Filter.
  4. On the first theme card in the results, click the Install button.
  5. Wait for the installation to complete.
  6. Observe that the button updates to "Activate", but there is no "Live Preview" button.
  7. Install the second theme in the results list.
  8. Wait for the installation to complete.
  9. Observe that both the "Activate" and "Live Preview" buttons are correctly displayed.

Expected Results:

All installed theme cards in the results should display both:

  • Activate
  • Live Preview

Actual Results:

The first theme card only displays:

  • Activate

The "Live Preview" button is missing.

Subsequent installed theme cards correctly display both buttons.

Attachments (13)

Huzaifa-20260226063345.png (2.0 MB ) - added by huzaifaalmesbah 5 months ago.
live-preview-missing-for-block-theme.gif (5.0 MB ) - added by huzaifaalmesbah 5 months ago.
@westonruter You’re right. I’m seeing this issue not just on the first card, The Live Preview button is missing across for block theme.
64729-trunk-block-activate-only.png (4.3 MB ) - added by softglaze 2 weeks ago.
Trunk: block theme cards after AJAX install show only "Activate" — no preview button
64729-pr-block-both-buttons.png (4.3 MB ) - added by softglaze 2 weeks ago.
PR 11184: block theme card after AJAX install shows "Activate" and "Live Preview"
64729-pr-siteeditor-preview.png (258.5 KB ) - added by softglaze 2 weeks ago.
PR 11184: Live Preview opens Site Editor with wp_theme_preview=legacy-law (previews the selected theme)
64729-pr-classic-both-buttons.png (276.0 KB ) - added by softglaze 2 weeks ago.
PR 11184: classic theme card still shows "Activate" and "Live Preview" (no regression)
64729-pr-classic-customizer.png (3.3 MB ) - added by softglaze 2 weeks ago.
PR 11184: classic theme Live Preview still opens the Customizer
After-Theme-LivePreview-Patch.png (1.8 MB ) - added by nazmulasif 12 days ago.
After applying patch
Before-Theme-LivePreview.png (1.9 MB ) - added by nazmulasif 12 days ago.
Before applying patch
live-preview-before-patch.png (1.7 MB ) - added by iamraju 11 days ago.
Live Preview Before Apply Patch
live-preview-after-apply-patch.png (1.6 MB ) - added by iamraju 11 days ago.
Live Preview After Apply Patch
before-patch.png (520.9 KB ) - added by shailu25 11 days ago.
Before Patch
after-patch.png (543.8 KB ) - added by shailu25 11 days ago.
After Patch

Change History (36)

#2 @westonruter
5 months ago

There was an issue until 6.9 in which the Live Preview button was missing for block themes, so this may be related. See #64159.

@huzaifaalmesbah
5 months ago

@westonruter You’re right. I’m seeing this issue not just on the first card, The Live Preview button is missing across for block theme.

#3 @huzaifaalmesbah
5 months ago

  • Summary Missing "Live Preview" button on the first theme card after installation in "Add Themes" screenMissing “Live Preview” button for block themes after installation on the “Add Themes” screen

#4 @madhavishah01
5 months ago

I tested this locally on WordPress 7.0 Beta 1, and the issue is still reproducible. After installing block themes from the Add Themes screen, the “Live Preview” button is missing for every theme card and only the “Activate” button appears.

I’ve attached a screenshot for reference.
https://prnt.sc/fqb4sBphp2zj

#5 @westonruter
5 months ago

  • Keywords needs-patch added
  • Milestone Awaiting Review7.0
  • Version6.9

Curious that this seems to be a regression from 6.9.

@huzaifaalmesbah @madhavishah01 Are you able to reproduce the issue in 6.9?

#6 @huzaifaalmesbah
5 months ago

Reproduction Report

Environment

  • WordPress: 6.9.1
  • PHP: 8.2.30
  • Server: nginx/1.29.4
  • Database: mysqli (Server: 9.5.0 / Client: mysqlnd 8.2.30)
  • Browser: Chrome 145.0.0.0
  • OS: macOS
  • Theme: Twenty Twenty-Five 1.4
  • MU Plugins: None activated
  • Plugins:
    • Test Reports 1.2.1

Steps taken

  1. Navigate to Appearance → Themes → Add New Theme.
  2. Use any of the following:
    • Click the Block Themes tab, OR
    • Search for a keyword (e.g., "hello")
  3. click the Install button.
  4. Wait for the installation to complete.
  5. Observe that the button updates to "Activate", but there is no "Live Preview" button.
  6. 🐞 Bug occurs

Screenshots/Screencast with results

https://i.ibb.co/1t2M5YdM/Huzaifa-20260227003016.png
https://i.ibb.co/7NgF4w0V/Huzaifa-20260227003516.png

#7 follow-up: @sabernhardt
5 months ago

On the theme installation page, [52819] intentionally removed the Live Preview links for any block themes (backported to 5.9.3). See #54878 and theme-install.php.

#8 in reply to: ↑ 7 @noruzzaman
5 months ago

Replying to sabernhardt:

On the theme installation page, [52819] intentionally removed the Live Preview links for any block themes (backported to 5.9.3). See #54878 and theme-install.php.

@sabernhardt Thanks for pointing this out and for the reference. I’m just curious about the inconsistency, before installing a block theme, the Preview button is visible, but after installation the Live Preview button disappears (only Activate shows).

Meanwhile, classic themes still show Live Preview after installation on the same page. This feels a bit inconsistent and potentially confusing from a UX perspective.

This ticket was mentioned in PR #11184 on WordPress/wordpress-develop by @sanket.parmar.


5 months ago
#9

  • Keywords has-patch added; needs-patch removed

## Description

After installing a block theme from Appearance → Themes → Add New Theme, the "Preview" button was missing — only "Activate" appeared. Classic themes correctly showed both "Activate" and "Live Preview". This inconsistency was present across all tabs and search results.

The root cause is threefold:

  1. wp_ajax_install_theme() was always sending customizeUrl pointing to the classic Customizer (customize.php) for all themes, including block themes. Block themes don't support the Customizer, so the button was either broken or absent.
  1. wp_ajax_query_themes() (the on-load data for all theme cards) was sending site-editor.php for installed block themes, but without the wp_theme_preview=<slug> query parameter. Without it, clicking Preview would open the Site Editor for the *currently active* theme instead of the selected one.
  1. The Underscore.js template in theme-install.php had a blanket <# if ( ! data.block_theme ) { #> guard added by #54878 in 2022 to prevent pointing block themes at the Customizer. That suppression was never updated after context-aware Site Editor preview URLs became available.

---

## Changes

wp-admin/includes/ajax-actions.php — two functions:

  • wp_ajax_install_theme(): For block themes, sends site-editor.php?wp_theme_preview=<slug>&return=... instead of the classic Customizer URL. Mirrors the existing logic in class-theme-installer-skin.php used by the non-AJAX full-page install path. Capability check also broadened to allow block themes regardless of the customize cap.
  • wp_ajax_query_themes(): Adds wp_theme_preview=<slug> to the Site Editor URL for already-installed block themes shown on page load, so the button actually previews the correct theme.

wp-admin/theme-install.php:

  • Replaces the blanket block-theme suppression with an explicit branch: block themes render a plain Preview link (no load-customize); classic themes keep Live Preview with load-customize.

js/_enqueues/wp/updates.js:

  • installThemeSuccess(): Checks response.blockTheme when replacing the .preview button post-install. Block themes get a plain Preview <a> without the load-customize class (which triggers Customizer-specific JS); classic themes are unchanged.

---

## Testing Instructions

Prerequisites: A WordPress install with at least one classic theme and one block theme available but not yet installed.

### Block theme — AJAX install path

  1. Go to Appearance → Themes → Add New Theme.
  2. Search for a block theme (e.g. "Twenty Twenty-Four") or open the Block Themes tab.
  3. Click Install on any block theme that is not yet installed.
  4. Wait for installation to complete.
  5. Both Activate and Preview buttons should appear immediately.
  6. Click Preview — it should open the Site Editor with that theme previewed, not the Customizer.

### Classic theme — AJAX install path

  1. On the same screen, install a classic theme (e.g. "Twenty Twenty").
  2. Both Activate and Live Preview buttons should appear.
  3. Click Live Preview — it should open the Customizer with that theme.

### Already-installed block theme cards (page-load path)

  1. Install a block theme via any method and do not activate it.
  2. Return to Appearance → Themes → Add New Theme and browse any tab.
  3. Find the installed block theme card.
  4. The card should show Activate and Preview.
  5. Click Preview — it should open the Site Editor previewing that specific theme, not the currently active one.

### No regression — full-page install path

  1. Navigate directly to wp-admin/update.php?action=install-theme&theme=<slug> (non-AJAX install).
  2. Post-install buttons remain correct — this path was already working via class-theme-installer-skin.php.

### Active block theme

  1. Activate a block theme.
  2. Go to Add New Theme and find the active theme's card.
  3. It should show Activated (disabled) and Customize (linking to the Site Editor) — unchanged behaviour.

---

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

---

## Use of AI Tools

@audrasjb commented on PR #11184:


5 months ago
#10

This PR fixes the issue on my side.
screen-capture (9).webm

@rcorrales commented on PR #11184:


5 months ago
#11

Tested this locally and the fix works as expected. Block themes now correctly show the Preview button after installation, and clicking it opens the Site Editor with the right theme previewed via wp_theme_preview.

One small thing I noticed is that the PR labels the block theme button "Preview" (in both theme-install.php and updates.js), but classic themes on the same screen show "Live Preview".

The other screens that handle this (themes.php, class-theme-installer-skin.php, class-theme-upgrader-skin.php) all use "Live Preview" for block themes too. Is "Preview" intentional here, or can it be changed to "Live Preview" for consistency?

https://github.com/user-attachments/assets/9ecc567c-4730-4848-9816-7b068c5eff73

#12 @audrasjb
5 months ago

  • Milestone 7.07.1

As we're a few hours from 7.0 RC1, I'm moving this ticket to milestone 7.1 to give this more time for testing.

@sanket.parmar commented on PR #11184:


4 months ago
#13

Hi, @rbcorrales

Good catch, thanks! You're right — themes.php and class-theme-installer-skin.php both use "Live Preview" for block themes, so "Preview" was inconsistent. Updated both theme-install.php and updates.js to use "Live Preview" across the board. The block theme button still intentionally omits the load-customize class (to avoid triggering Customizer-specific JS), but the label is now consistent with the rest of the codebase.

This ticket was mentioned in Slack in #core-test by huzaifaalmesbah. View the logs.


2 weeks ago

@softglaze
2 weeks ago

Trunk: block theme cards after AJAX install show only "Activate" — no preview button

@softglaze
2 weeks ago

PR 11184: block theme card after AJAX install shows "Activate" and "Live Preview"

@softglaze
2 weeks ago

PR 11184: Live Preview opens Site Editor with wp_theme_preview=legacy-law (previews the selected theme)

@softglaze
2 weeks ago

PR 11184: classic theme card still shows "Activate" and "Live Preview" (no regression)

@softglaze
2 weeks ago

PR 11184: classic theme Live Preview still opens the Customizer

#15 @softglaze
2 weeks ago

  • Keywords has-test-info has-screenshots added

Test Report — PR 11184 at current head (755c924728), including the "Preview" → "Live Preview" label revision from comment:13

Both earlier test reports (comment:10, comment:11) predate the label update in the PR, so this run covers the current head.

Environment

  • WordPress: 7.1-alpha trunk (wordpress-develop, npm run env, serving src/)
  • Server: nginx (Docker local environment), Browser: Chrome, OS: Windows 11 host
  • Cache disabled in DevTools; build:dev rebuilt after checkout

Reproduction on trunk (before)

Confirmed the bug on current trunk: after AJAX-installing block themes from the Block Themes tab, cards show only Activate — no preview button (classic themes on the same screen correctly show both). The AJAX install response for a block theme points customizeUrl at the Customizer:

"themeName": "Elisen Photography",
"blockTheme": true,
"customizeUrl": "http://localhost:8889/wp-admin/customize.php?theme=elisen-photography&return=%2Fwp-admin%2Ftheme-install.php"

Trunk: block theme cards after AJAX install show only "Activate" — no preview button

Results with PR 11184 applied

Test Expected Result
Block theme, AJAX install (Legacy Law) Activate + Live Preview appear; label reads "Live Preview" ✅ Both buttons, correct label
Live Preview destination (block) Site Editor previewing the selected theme via wp_theme_preview ✅ Opens site-editor.php?wp_theme_preview=legacy-law, sidebar shows "Previewing Legacy Law" with "Activate Legacy Law"
Classic theme, AJAX install (Hello Elementor) Activate + Live Preview; opens Customizer ✅ Both buttons; opens customize.php?theme=hello-elementor
Page-load path (installed, inactive block theme) Card shows Activate + Live Preview on reload
Active block theme card (Twenty Twenty-Five) Activated (disabled) + Customize, unchanged

The AJAX install response for a block theme now returns the correct URL:

"themeName": "Contact Sheet",
"blockTheme": true,
"customizeUrl": "http://localhost:8889/wp-admin/site-editor.php?wp_theme_preview=contact-sheet&return=%2Fwp-admin%2Ftheme-install.php"

PR 11184: block theme card after AJAX install shows "Activate" and "Live Preview"
PR 11184: Live Preview opens Site Editor with wp_theme_preview=legacy-law (previews the selected theme)

Classic path unchanged (no regression):

PR 11184: classic theme card still shows "Activate" and "Live Preview" (no regression)
PR 11184: classic theme Live Preview still opens the Customizer

Installs were verified via wp theme list after each step to rule out failed installs mimicking the missing button. Everything works as described in the PR; the label is now consistent with themes.php and the installer skins.

@softglaze commented on PR #11184:


12 days ago
#16

Tested the current head (755c924728), including the "Preview" → "Live Preview" label revision from comment:13 — both earlier test reports predate that change.

Block-theme AJAX install now shows both buttons with the correct label, and the install response returns site-editor.php?wp_theme_preview=… instead of customize.php. Classic themes (Hello Elementor) are unchanged and still open the Customizer. Page-load path and the active-theme card also verified, with wp theme list checked after each install to rule out failed installs mimicking the bug.

Full report with screenshots on Trac: https://core.trac.wordpress.org/ticket/64729#comment:15

This ticket was mentioned in Slack in #core-test by softglaze. View the logs.


12 days ago

#18 @nazmulasif
12 days ago

Test Report

Patch tested: https://github.com/WordPress/wordpress-develop/pull/11184

Environment

  • WordPress: 7.1-alpha-20260622.093256
  • Subdirectory: No
  • PHP: 7.4.33
  • Server: PHP.wasm
  • Database: WP_SQLite_Driver (Server: 8.0.38 / Client: 3.51.0)
  • Browser: Chrome 150.0.0.0
  • OS: macOS
  • Theme: Twenty Twenty-Five 1.5
  • MU Plugins: None activated
  • Plugins:
    • Test Reports 1.3.0

Steps taken

  1. Navigated to Appearance → Themes → Add New Theme, searched for a keyword (e.g., "hello"), and installed the first theme card in the results list.
  2. Verified that without the patch, the first installed theme card only displays the "Activate" button while omitting the "Live Preview" button.
  3. Tested the environment using the WordPress Playground PR preview link for pull request #11184.
  4. Repeated the theme search and installation process for the first theme card with the patch applied.
  5. Observed that both the "Activate" and "Live Preview" buttons are now correctly and consistently displayed on the first installed theme card.
  • ✅ Patch is solving the problem

Expected result

  • All installed theme cards in the results list—including the very first card—should display both "Activate" and "Live Preview" buttons once installation completes.

Additional Notes

  • Successfully tested and verified pull request #11184. The patch correctly resolves the rendering bug where the first theme card failed to show the "Live Preview" option post-installation.

Screenshots/Screencast with results

  • Yes

Support Content

  • Website Playground URL with parameters used for testing:

https://playground.wordpress.net/?core-pr=11184#%7B%22$schema%22:%22https://playground.wordpress.net/blueprint-schema.json%22,%22landingPage%22:%22/wp-admin%22,%22login%22:true,%22preferredVersions%22:%7B%22php%22:%227.4%22%7D,%22features%22:%7B%22networking%22:true%7D%7D

@nazmulasif
12 days ago

After applying patch

@nazmulasif
12 days ago

Before applying patch

#19 @ugyensupport
12 days ago

Test Report

Patch tested: https://github.com/WordPress/wordpress-develop/pull/11184

Environment

  • WordPress: 7.1-beta3
  • Subdirectory: No
  • PHP: 8.4.14
  • Server: nginx/1.21.4
  • Database: mysqli (Server: 5.7.44-log / Client: mysqlnd 8.4.14)
  • Browser: Chrome 150.0.0.0
  • OS: macOS
  • Theme: Twenty Twenty-Five 1.5
  • MU Plugins: None activated
  • Plugins:
    • Test Reports 1.3.0
    • WordPress Beta Tester 4.0.0

Steps taken

Log into the WordPress administration dashboard.
Navigate to Appearance → Themes → Add New Theme.
Use any of the following:
Search for a keyword (e.g., "hello"), OR
Click the Popular tab, OR
Click the New tab, OR
Click the Block Themes tab, OR
Apply any Feature Filter.
On the first theme card in the results, click the Install button.
Wait for the installation to complete.
Observe that the button updates to "Activate", but there is no "Live Preview" button.
Install the second theme in the results list.
Wait for the installation to complete.
Observe that both the "Activate" and "Live Preview" buttons are correctly displayed.
✅ Patch is solving the problem

Expected result

All installed theme cards in the results should display both:

Activate
Live Preview

Patch Assurance

  • ✅ Patch is solving the problem

Screenshots/Screencast with results

Last edited 12 days ago by ugyensupport (previous) (diff)

#20 @iamraju
11 days ago

Test Report

Patch tested: https://github.com/WordPress/wordpress-develop/pull/11184

Environment

  • WordPress: 7.1-alpha-20260622.093256
  • Subdirectory: No
  • PHP: 7.4.33
  • Server: PHP.wasm
  • Database: WP_SQLite_Driver (Server: 8.0.38 / Client: 3.51.0)
  • Browser: Chrome 150.0.0.0
  • OS: macOS
  • Theme: Twenty Twenty-Five 1.5
  • MU Plugins: None activated
  • Plugins:
    • Test Reports 1.3.0

Steps taken

  1. Opened the WordPress Playground preview for PR #11184.
  2. Navigated to Appearance → Themes → Add New Theme.
  3. Searched for a theme using the keyword "hello".
  4. Installed the first two themes returned in the search results.
  5. Before applying the patch, verified that the installed theme card displayed only the "Activate" button and did not display the "Live Preview" button.
  6. Repeated the same steps with the patched version.
  7. Confirmed that the installed theme card correctly displayed both the "Activate" and "Live Preview" buttons.

Result: ✅ Patch is solving the problem.

Expected result

After installing a theme from the Add New Theme screen, the installed theme card should consistently display both the "Activate" and "Live Preview" buttons.

Additional Notes

  • The issue was reproducible before applying the patch.
  • After applying the patch, the missing "Live Preview" button appeared as expected.
  • No regressions or unexpected behavior were observed during testing.

Screenshots/Screencast with results

  • Screenshot before applying the patch (showing only the "Activate" button).
  • Screenshot after applying the patch (showing both "Activate" and "Live Preview" buttons).

Support Content

  • WordPress Playground preview for PR #11184.
  • No additional configuration or code changes were required beyond applying the patch.

@iamraju
11 days ago

Live Preview Before Apply Patch

@iamraju
11 days ago

Live Preview After Apply Patch

#21 @shailu25
11 days ago

Test Report

This Report Validates that the indicated patch address the issue.✅

Patch Tested: https://github.com/WordPress/wordpress-develop/pull/11184

Environment:

WordPress - 7.1-alpha-20260622.093256
OS - Windows
Browser - Chrome
Theme: Twenty Twenty Five
PHP - 8.2
Plugin - None

Actual Results:

  • Issue Resolved with Patch ✅

Supplemental Artifacts

  • Attached

@shailu25
11 days ago

Before Patch

@shailu25
11 days ago

After Patch

This ticket was mentioned in Slack in #core by adrianduffell. View the logs.


9 days ago

#23 @adrianduffell
9 days ago

  • Keywords early added
  • Milestone 7.1Future Release

This was discussed in today's bug scrub. It has a PR ready for review and multiple successful test reports but I’d like to punt this since RC 1 is due in a few days time. It looks valuable to fix soon, so tagging with early for consideration in 7.2.

Note: See TracTickets for help on using tickets.