[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 16:24:50 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 superpoincare):

 Hi @pbearne,

 Something like:

 {{{#!php
 <?php
 add_filter( 'wp_content_img_tag', function( $filtered_image ) {
         return "<tag>$filtered_image</tag>";
 } );
 }}}

 leads to:


 {{{
 <tag><tag><img src="https://demo2.cloudwp.dev/trial-3z1wywz1/wp-
 content/themes/twentytwentytwo/assets/images/flight-path-on-
 transparent-d.png" alt="Illustration of a bird flying."/></tag></tag>
 }}}

 in HTML.

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


More information about the wp-trac mailing list