Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Podcast Block always loads styles: wp-mediaelement.min.css and mediaelementplayer-legacy.min.css #20437

Closed
mikeyarce opened this issue Jul 22, 2021 · 2 comments
Labels
[Block] Podcast Player [Type] Bug When a feature is broken and / or not performing as intended

Comments

@mikeyarce
Copy link
Member

The Podcast Block in Jetpack is always loading the following stylesheets even if there is no Podcast block present or if it's being used.

http://localhost/wp-includes/js/mediaelement/wp-mediaelement.min.css?ver=5.8
http://localhost/wp-includes/js/mediaelement/mediaelementplayer-legacy.min.css?ver=4.2.16

Steps to reproduce the issue

  1. Go to a clean install of WordPress (5.8 at the time) and use the latest Jetpack release (9.9.1 but also 10-alpha has the same thing)
  2. Go to the homepage of the site
  3. Check the Network Panel
  4. See stylesheets there even though they are not needed

What I expected

If I'm not using the Podcast block, I don't need these styles being loaded.

What happened instead

They loaded.

Screenshots
Screen Shot on 2021-07-22 at 14:56:29

What is happening

What's happening is that here we're declaring the style for the block:

This passes through wp_enqueue_registered_block_scripts_and_styles here which actually does a wp_enqueue_style for the styles passed, regardless if the block is being used or not:
https://github.com/WordPress/WordPress/blob/60c39d780530ac8e8c29d3619e0fbc4a88ee9eb6/wp-includes/script-loader.php#L2398

@brucea8c
Copy link

brucea8c commented Sep 28, 2022

This is also noted in this forums post with the user looking for a fix or how to prevent these from loading.

@jeherve
Copy link
Member

jeherve commented Feb 7, 2025

This seems to be fixed now. Closing.

@jeherve jeherve closed this as completed Feb 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Podcast Player [Type] Bug When a feature is broken and / or not performing as intended
Projects
None yet
Development

No branches or pull requests

4 participants