[wp-trac] [WordPress Trac] #54884: Load scripts conditionally to reduce page loading and processing time

WordPress Trac noreply at wordpress.org
Tue Jan 25 07:40:46 UTC 2022


#54884: Load scripts conditionally to reduce page loading and processing time
---------------------------+--------------------------------------
 Reporter:  galbaras       |       Owner:  (none)
     Type:  enhancement    |      Status:  new
 Priority:  normal         |   Milestone:  Awaiting Review
Component:  Script Loader  |     Version:
 Severity:  normal         |  Resolution:
 Keywords:                 |     Focuses:  javascript, performance
---------------------------+--------------------------------------

Comment (by galbaras):

 OK, so turns out the `wp-embed` converts links into embeds, which never
 happens on the front end... The following code seems to do the trick, but
 doing it in core is better, of course:


 {{{
 add_action( 'wp_footer', 'remove_wp_embed_script' );
 function remove_wp_embed_script() {
         if ( ! defined( 'IFRAME_REQUEST' ) ) {
                 wp_deregister_script( 'wp-embed' );
         }
 }
 }}}

 > 2) jQuery migrate is used for theme / plugin compatibility with newer
 versions of wordpress.

 This means that it should be possible to disable it per site, rather than
 load it "just in case" on sites that don't need it. See also (#37110 and)
 #51812.

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


More information about the wp-trac mailing list