• Resolved romantcig

    (@romantcig)


    Product: FV Player
    WordPress version: 6.8.2
    PHP version: 8.4Problem description

    FV 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

    1. Activate FV Player.
    2. Open the site homepage (no shortcode used).[fvplayer]
    3. Inspect the HTML output:

    HTML

    <link rel="stylesheet" id="fv_freedomplayer_admin-css" href="/wp-content/plugins/fv-player/css/admin.css?...">
    1. 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_enqueue

    Line ~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.css should 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.css as 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

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author FolioVision

    (@foliovision)

    Hello romantcig,

    Thank you for the detailed bug report.

    Since the admin.css file only loads for logged in users, it will not affect PageSpeed Insights. Although if you use Lighthouse (which we like a lot) in your web browser when logged in, you will notice it.

    The reason why that file is loaded in front-end at all is that it also serves the Video Checker, which is an optional FV Player feature to check your video files encoding. More information about that can be found at https://foliovision.com/player/troubleshooting/how-to-use-video-checker

    We can improve this on the new version of our plugin which is FV Player 8: https://wordpress.org/plugins/fv-player

    The Video Checker styling should be separated from the rest and it could only load if user has the permissions to end the post.

    Thanks,
    Martin

    Thread Starter romantcig

    (@romantcig)

    Hello Martin, Thanks for the explanation. I just want to clarify that in my actual tests, the admin.css file was also visible to non‑logged‑in visitors. That means PageSpeed Insights (which always tests as a visitor, not logged in) also detects it as a render‑blocking stylesheet. It would be very helpful if this file was completely limited to editors/admins who really use the Video Checker feature, otherwise it affects frontend performance reports. Thanks again for considering the improvement in FV Player 8.

    Plugin Author FolioVision

    (@foliovision)

    Hello romantcig,

    I tried to reproduce the issue with FV Player 7, but the admin.css file did not load for me when I was not logged in.

    I don’t see how it could get loaded.

    If you could try to reproduce that issue with FV Player 8, that would be great.

    Thanks,
    Martin

    Thread Starter romantcig

    (@romantcig)

    Hello Martin,

    Sorry for the confusion. I realize now that part of the misunderstanding came from my report — I accidentally included the old FV Player 7.5 plugin link (fv-wordpress-flowplayer), while our site is actually already running FV Player 8 (fv-player).

    Because of that, I understand why you kept recommending FV Player 8 in your replies. My mistake.

    In addition, as I explained earlier, my AI tool gave me misleading information, which made me think admin.css was loading for guest visitors. We later confirmed this is not the case: it only appears for logged‑in admins with the Video Checker feature. So this is normal behavior, not a bug.

    Again, I apologize for the mix‑up and for causing you extra work.

    Plugin Author FolioVision

    (@foliovision)

    Hello romantcig,

    Thank you for letting us know.

    While the AI tools are very powerful and they often surprise with good looking code or nice suggestions, it’s always important to double-check everything “they” do.

    Thanks,
    Martin

Viewing 5 replies - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.