[wp-trac] [WordPress Trac] #63076: Site Editor: Remove admin bar from site preview for classic theme

WordPress Trac noreply at wordpress.org
Fri Mar 7 16:26:37 UTC 2025


#63076: Site Editor: Remove admin bar from site preview for classic theme
--------------------------+--------------------
 Reporter:  wildworks     |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  6.8
Component:  Editor        |    Version:
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+--------------------
 Originally reported on https://github.com/WordPress/gutenberg/issues/69474

 Starting with 6.8, classic themes with editor-style support or theme.json
 file can use StyleBook. At the same time, the root page of the site editor
 shows a front-end preview of the theme.

 To remove the admin bar from this preview, there is
 [https://github.com/WordPress/gutenberg/blob/acb176ef83c704e36144a59303d59551a00f2145/packages
 /edit-site/src/components/editor/site-preview.js#L26-L45 JS code] to
 remove it after the iframe content is loaded.

 This JS code runs after the site is loaded, so the admin bar appears for a
 moment on initial load.

 This issue can be solved by injecting CSS, as suggested in
 [https://github.com/WordPress/gutenberg/pull/69480 this Gutenberg PR], but
 other approaches have been proposed to use PHP hooks to not show the admin
 bar in the first place.

 Using the `show_admin_bar` hook is probably the best solution, but I'd be
 happy to discuss what the best approach is.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/63076>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list