Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

alleyinteractive/wp_enqueue_media_override

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

wp_enqueue_media Override

Beat WordPress to the punch in enqueueing media, and do so more performantly.

The main function here is ripped from core, with a couple of major differences in how it queries for "has_audio", "has_video", and media months. These queries are extremely slow on sites with as much media as this site has, and this is a band-aid to speed things up. WordPress doesn't currently offer a way to intercept these queries or override this function, but the function does check if did_action( 'wp_enqueue_media' ) and returns if true. Therefore, if we were to fire that action before WordPress does, we can safely override the functionality.

This plugin is a stopgap and can be deprecated once Trac tickets 32264 and 31071 are closed.

Most of this code is copied from WordPress core, with most of the performance updates coming from @philipjohn, as posted on https://core.trac.wordpress.org/ticket/32264.

About

Override wp_enqueue_media to be more performant

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages