[wp-trac] [WordPress Trac] #58853: Fix shortcode output not receiving image (and other) optimizations

WordPress Trac noreply at wordpress.org
Tue Sep 26 00:11:22 UTC 2023


#58853: Fix shortcode output not receiving image (and other) optimizations
-------------------------------------------------+-------------------------
 Reporter:  flixos90                             |       Owner:  flixos90
     Type:  defect (bug)                         |      Status:  closed
 Priority:  normal                               |   Milestone:  6.4
Component:  Media                                |     Version:  5.5
 Severity:  normal                               |  Resolution:  fixed
 Keywords:  2nd-opinion has-patch has-unit-      |     Focuses:
  tests                                          |  performance
-------------------------------------------------+-------------------------
Changes (by flixos90):

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


Comment:

 In [changeset:"56693" 56693]:
 {{{
 #!CommitTicketReference repository="" revision="56693"
 Media: Ensure images within shortcodes are correctly considered for
 loading optimization attributes.

 Prior to this change, images added in shortcodes would be considered
 separately from all other images within post content, which led to
 incorrect application of the loading optimization attributes
 `loading="lazy"` and `fetchpriority="high"`.

 This changeset changes the filter priority of `wp_filter_content_tags()`
 from the default `10` to `12` on the various content filters it is hooked
 in, in order to run that function after parsing shortcodes. While this may
 technically be considered a backward compatibility break, substantial
 research and lack of any relevant usage led to the assessment that the
 change is acceptable given its benefits.

 An additional related fix included is that now the duplicate processing of
 images is prevented not only for post content blobs (`the_content`
 filter), but also for widget content blobs (`widget_text_content` and
 `widget_block_content` filters).

 Props joemcgill, mukesh27, costdev, spacedmonkey, flixos90.
 Fixes #58853.
 }}}

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


More information about the wp-trac mailing list