[wp-trac] [WordPress Trac] #55510: The `wp_content_img_tag` filter can appear to run twice when used to wrap image tags

WordPress Trac noreply at wordpress.org
Mon Apr 11 23:45:58 UTC 2022


#55510: The `wp_content_img_tag` filter can appear to run twice when used to wrap
image tags
------------------------------------------+-----------------------
 Reporter:  peterwilsoncc                 |       Owner:  flixos90
     Type:  defect (bug)                  |      Status:  assigned
 Priority:  normal                        |   Milestone:  6.0
Component:  Media                         |     Version:
 Severity:  normal                        |  Resolution:
 Keywords:  needs-patch needs-unit-tests  |     Focuses:
------------------------------------------+-----------------------

Comment (by flixos90):

 @peterwilsoncc
 > The same issue will occur if `wp_filter_content_tags()` is run multiple
 times on the same blob of HTML

 While I definitely think we need to fix the duplicate logic execution here
 that causes the bug, calling `wp_filter_content_tags()` twice is a
 different topic. This is not something that should be done, WP core
 doesn't do it, and we also expect other `the_content` filters for example
 to not be run twice.

 I'd be in favor of fixing the underlying issue of duplicate code execution
 within a single call to `wp_filter_content_tags()` since that is really
 the problem here. Whereas calling `wp_filter_content_tags()` twice on the
 same blob of content would be `_doing_it_wrong` :)

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


More information about the wp-trac mailing list