Bug Report – FV Player loads admin.css in frontend
-
Product: FV Player
WordPress version: 6.8.2
PHP version: 8.4Problem descriptionFV Player incorrectly loads on frontend pages.
This stylesheet is intended for the WordPress admin (wp‑admin), but it is being injected into the frontend .css/admin.css<head>The file is included even for visitors and can be detected by Google PageSpeed / Lighthouse, adding unnecessary requests and harming performance metrics.Steps to reproduce
- Activate FV Player.
- Open the site homepage (no shortcode used).
[fvplayer] - Inspect the HTML output:
HTML
<link rel="stylesheet" id="fv_freedomplayer_admin-css" href="/wp-content/plugins/fv-player/css/admin.css?...">- Run PageSpeed Insights or Lighthouse – the request is always reported as a render‑blocking CSS resource.
admin.css
Root cause analysis
In the plugin code (, function ):
models/fv-player.phpcss_enqueueLine ~1859
PHP
if( is_admin() && did_action('admin_footer') ) { echo "<link rel='stylesheet' id='fv_freedomplayer-css' href='".esc_attr($sURL)."?ver=".$sVer."' type='text/css' media='all' />\n"; if ( isset($sURLAdditions) ) { echo "<link rel='stylesheet' id='fv_freedomplayer-css-additions' href='".esc_attr($sURLAdditions)."?ver=".$sVerAdditions."' type='text/css' media='all' />\n"; }Line ~1886 / 1887
PHP
if ( is_user_logged_in() ) { wp_enqueue_style( 'fv_freedomplayer_admin', FV_FP_RELATIVE_PATH.'/css/admin.css', array(), filemtime( dirname(__FILE__).'/../css/admin.css' ) ); }- Issue 1: returns
is_admin()true在前端 AJAX 请求期间也是如此。因此,第 1859 行中的条件可以触发 - Issue 2:
is_user_logged_in()alone is too broad – it loads admin.css for any logged‑in user even on frontend, not just in wp‑admin.
Suggested fix
Restrict loading to true wp‑admin pages only, and exclude AJAX contexts.
Modified line ~1859
PHP
if( is_admin() && did_action('admin_footer') && !wp_doing_ajax() ) { echo "<link rel='stylesheet' id='fv_freedomplayer-css' href='".esc_attr($sURL)."?ver=".$sVer."' type='text/css' media='all' />\n"; if ( isset($sURLAdditions) ) { echo "<link rel='stylesheet' id='fv_freedomplayer-css-additions' href='".esc_attr($sURLAdditions)."?ver=".$sVerAdditions."' type='text/css' media='all' />\n"; }Modified line ~1886 / 1887
PHP
if ( is_user_logged_in() && is_admin() && !wp_doing_ajax() ) { wp_enqueue_style( 'fv_freedomplayer_admin', FV_FP_RELATIVE_PATH.'/css/admin.css', array(), filemtime( dirname(__FILE__).'/../css/admin.css' ) ); }Expected behavior
admin.cssshould load only in wp‑admin pages.- Frontend pages (for both guests and logged‑in users) should not include admin.css.
- Google PageSpeed / Lighthouse should no longer report
admin.cssas a render‑blocking resource.
Impact
- Removes unnecessary HTTP request from frontend.
- Reduces page weight and improves Core Web Vitals metrics.
- Prevents confusion for developers/users seeing “admin.css” in frontend markup.
Or maybe this isn’t a bug? I am hoping to get an answer
You must be logged in to reply to this topic.