Hi,
In an effort to squeeze the last few ms loading time improvement out of my website, I have a question about the standard WP mediaplayer scripts and css. I was experimenting with deregistering the script and css for that WP included mediaplayer stuff (/wp-includes/js/mediaelement/) like this in my child theme functions.php:
function deregister_media_elements(){
wp_deregister_script('wp-mediaelement');
wp_deregister_style('wp-mediaelement');
}
add_action('wp_enqueue_scripts','deregister_media_elements');
As far as I can tell from my experiments, this change does not affect any video capability within Enfold, not even including videos in a post the standard WP way… :-)
Am I right in this and can I do this without harm when using Enfold, or am I missing something?
Thanks in advance for clarifying,
Rob
Hey Rob,
Thank you for the inquiry.
You can actually toggle the script in the Enfold > Performance > Self hosted videos and audio features (WP-Mediaelement scripts) settings. The script is used for html5 videos and audios, so you can safely deregister the script if you are not using any of those. However, some plugins automatically requires the script, which might cause an error or produce a warning if the script is deregistered.
Best regards,
Ismael
Hi Ismael,
Thanks for the confirmation and the info, good to know. I already had that toggle set, but the player script + css continued to load on translated pages, I will take that up with the plugin developer too. That’s why I wanted to deregister it completely.
Have a good day!
Rob
Hi Rob,
Thanks for the update. Please let us know if you should need any further help on the topic or if we can close it.
Best regards,
Rikard
Hi Rikard,
Thanks for the help, you can close it.
Rob