[wp-trac] [WordPress Trac] #55203: Bug with get_post_galleries

WordPress Trac noreply at wordpress.org
Sun Feb 20 21:52:31 UTC 2022


#55203: Bug with get_post_galleries
--------------------------+-----------------------
 Reporter:  BinaryMoon    |       Owner:  costdev
     Type:  defect (bug)  |      Status:  accepted
 Priority:  normal        |   Milestone:  5.9.2
Component:  Media         |     Version:  5.9
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+-----------------------
Changes (by costdev):

 * keywords:  needs-testing =>


Comment:

 == Issue Reproduction Report

 === Env
 * Web Server: Apache
 * WordPress: 6.0-alpha-52448-src
 * Browser: Chrome
 * OS: Linux
 * Theme: Twenty Twenty-One
 * Plugins: None activated

 === Steps to test
 1. Add the following to `functions.php`:
 {{{#!php
 add_action(
         'the_post',
         static function( $post ) {
                 echo str_contains(
                         implode( '', get_post_galleries( $post ) ),
                         'Paragraph before gallery'
                 ) ? 'Reproduced.' : 'Not reproduced.';
         }
 );
 }}}
 2. Navigate to `Posts > Add New`.
 3. Insert a paragraph with the text: `Paragraph before gallery`
 4. Insert a gallery with any number of images.
 5. Publish the post.
 6. View the post.
 7. "Issue reproduced." should appear on the screen. ✅

 === Results
 - Issue reproduced.

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


More information about the wp-trac mailing list