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

WordPress Trac noreply at wordpress.org
Tue Mar 29 23:56:37 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:
Changes (by flixos90):

 * status:  reviewing => closed
 * resolution:   => fixed


 In [changeset:"53028" 53028]:
 #!CommitTicketReference repository="" revision="53028"
 Media: Introduce `wp_content_img_tag` filter.

 This filter allows modifying individual `img` tags within a blob of
 content that are by default processed by the `wp_filter_content_tags()`
 function. The addition of this filter facilitates plugins that tweak
 images to accomplish this goal without re-implementing duplicate content
 image parser logic, which furthermore can have a negative performance
 impact due to additional regular expressions.

 In addition to the filterable `img` tag, the filter receives the context
 (typically the function or filter in which the content is parsed) and the
 attachment ID. The latter may be 0, in case the image is not an attachment
 (for example when it is an external image URL).

 Props adamsilverstein, flixos90, pbearne, peterwilsoncc.
 Fixes #55347.

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

More information about the wp-trac mailing list