[wp-trac] [WordPress Trac] #64061: Backport: Add block visibility support

WordPress Trac noreply at wordpress.org
Fri Oct 3 10:17:20 UTC 2025


#64061: Backport: Add block visibility support
--------------------------------------+---------------------
 Reporter:  wildworks                 |       Owner:  (none)
     Type:  enhancement               |      Status:  new
 Priority:  normal                    |   Milestone:  6.9
Component:  Editor                    |     Version:
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:
--------------------------------------+---------------------

Comment (by rollybueno):

 == Test Report
 === Description
 This report validates whether the indicated patch works as expected.

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

 === Environment
 - WordPress: 6.9-alpha-60093-src
 - PHP: 8.2.29
 - Server: nginx/1.29.1
 - Database: mysqli (Server: 8.4.6 / Client: mysqlnd 8.2.29)
 - Browser: Chrome 140.0.0.0
 - OS: Linux
 - Theme: Twenty Twenty-Five 1.3
 - MU Plugins: None activated
 - Plugins:
   * Gutenberg 21.7.0
   * Test Reports 1.2.0

 === Actual Results
 1.  ✅ Issue resolved with patch.

 === Additional Notes
 - The following test code was used with 3 paragraphs, a gallery, a
 paragraph and a gallery
 - The first paragraph should not be visible on the front end since it used
 the "blockVisibility" set to false
 - The second paragraph should be visible on the front end with the
 "blockVisibility" set to true
 - The third paragraph should be visible on the front end since it has no
 "blockVisibility" metadata set
 - The gallery should visible on the front end with the "blockVisibility"
 set to true.
 - The last gallery should **not** visible on the front end with the
 "blockVisibility" set to false.

 {{{
 <!-- wp:paragraph {"metadata":{"blockVisibility":false}} -->
 <p>This text should NOT be visible on the front end.</p>
 <!-- /wp:paragraph -->

 <!-- wp:paragraph
 {"metadata":{"blockVisibility":true},"backgroundColor":"accent-2"} -->
 <p class="has-accent-2-background-color has-background">This text should
 be visible on the front end. With the "blockVisibility" set to true.</p>
 <!-- /wp:paragraph -->

 <!-- wp:paragraph
 {"style":{"elements":{"link":{"color":{"text":"var:preset|color|contrast"}}}},"backgroundColor":"accent-1","textColor":"contrast"}
 -->
 <p class="has-contrast-color has-accent-1-background-color has-text-color
 has-background has-link-color">This text also should should be visible on
 the front-end. No "blockVisibility" metadata set</p>
 <!-- /wp:paragraph -->

 <!-- wp:gallery {"metadata":{"blockVisibility":true},"linkTo":"none"} -->
 <figure class="wp-block-gallery has-nested-images columns-default is-
 cropped"><!-- wp:image
 {"id":58,"sizeSlug":"large","linkDestination":"none"} -->
 <figure class="wp-block-image size-large"><img src="http://localhost:8889
 /wp-content/uploads/2025/08/1dabab74-d31e-38a2-b581-3dfc3fe3d8ac-
 1024x682.jpg" alt="" class="wp-image-58"/></figure>
 <!-- /wp:image -->

 <!-- wp:image {"id":55,"sizeSlug":"large","linkDestination":"none"} -->
 <figure class="wp-block-image size-large"><img src="http://localhost:8889
 /wp-content/uploads/2025/08/c6198a5b-4c43-3f7d-9baf-
 326b72925649-1024x682.jpg" alt="" class="wp-image-55"/></figure>
 <!-- /wp:image -->

 <!-- wp:image {"id":52,"sizeSlug":"large","linkDestination":"none"} -->
 <figure class="wp-block-image size-large"><img src="http://localhost:8889
 /wp-content/uploads/2025/08/852f6bfb-b43a-31c8-b33f-82405f9d8fcc-
 1024x682.jpg" alt="" class="wp-image-52"/></figure>
 <!-- /wp:image --></figure>
 <!-- /wp:gallery -->

 <!-- wp:gallery {"metadata":{"blockVisibility":false},"linkTo":"none"} -->
 <figure class="wp-block-gallery has-nested-images columns-default is-
 cropped"><!-- wp:image
 {"id":58,"sizeSlug":"large","linkDestination":"none"} -->
 <figure class="wp-block-image size-large"><img src="http://localhost:8889
 /wp-content/uploads/2025/08/1dabab74-d31e-38a2-b581-3dfc3fe3d8ac-
 1024x682.jpg" alt="" class="wp-image-58"/></figure>
 <!-- /wp:image -->

 <!-- wp:image {"id":55,"sizeSlug":"large","linkDestination":"none"} -->
 <figure class="wp-block-image size-large"><img src="http://localhost:8889
 /wp-content/uploads/2025/08/c6198a5b-4c43-3f7d-9baf-
 326b72925649-1024x682.jpg" alt="" class="wp-image-55"/></figure>
 <!-- /wp:image -->

 <!-- wp:image {"id":52,"sizeSlug":"large","linkDestination":"none"} -->
 <figure class="wp-block-image size-large"><img src="http://localhost:8889
 /wp-content/uploads/2025/08/852f6bfb-b43a-31c8-b33f-82405f9d8fcc-
 1024x682.jpg" alt="" class="wp-image-52"/></figure>
 <!-- /wp:image --></figure>
 <!-- /wp:gallery -->
 }}}


 === Supplemental Artifacts
 [[Image(https://i.imgur.com/SUSIAhR.png)]]
 [[Image(https://i.imgur.com/P3oemRq.png)]]

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/64061#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list