[wp-trac] [WordPress Trac] #55347: There should be filter for image tag in wp_filter_content_tags()

WordPress Trac noreply at wordpress.org
Thu Mar 31 17:05:53 UTC 2022


#55347: There should be filter for image tag in wp_filter_content_tags()
---------------------------------------------+-----------------------
 Reporter:  pbearne                          |       Owner:  flixos90
     Type:  enhancement                      |      Status:  closed
 Priority:  normal                           |   Milestone:  6.0
Component:  Media                            |     Version:
 Severity:  normal                           |  Resolution:  fixed
 Keywords:  has-patch has-unit-tests commit  |     Focuses:
---------------------------------------------+-----------------------

Comment (by pbearne):

 I added another unit test
 I am not seeing this issue
 So we check the function is not being called twice

 {{{#!php
 <?php
         public function test_wp_filter_content_tag_test() {
                 $content = '<p>Image, standard. Should have srcset and
 sizes.</p>
                         <img src="http://url.tld" alt="" />';
                 add_filter(
                         'wp_content_img_tag',
                         static function( $filtered_image ) {
                                 return "<tag>$filtered_image</tag>";
                         }
                 );
                 $this->assertSame( '<p>Image, standard. Should have srcset
 and sizes.</p>
                         <tag><img src="http://url.tld" alt="" /></tag>',
 wp_filter_content_tags( $content ) );
         }
 }}}

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


More information about the wp-trac mailing list