• Resolved e dev

    (@efishinsea)


    As a follow-up to this closed question about Console errors – loading S2Member CSS. Not a supported MIME type

    I was having the same issue (read link above) at my host FlyWheel and eventually the support team there (which is awesome) helped me to sort out. Their hosting architecture has the core WordPress files in a location outside of the normal “root” so when s2Member was trying to call them the way you would anywhere else, the core files weren’t found. To complicate matters, the result was a returned 404 type error rather than a JS or CSS file, so the console would show ‘MIME TYPE MISMATCH’ errors.. which were a total red herring:

    //console log with slight edits 
    
    GET
    https://www.somewebsite.com/wp-content/plugins/s2member/s2member-o.php?ws_plugin__s2member_css=1&qcABC=1&ver=240325-42710353
    
    GET
    https://www.somewebsite.com/wp-content/plugins/s2member/s2member-o.php?ws_plugin__s2member_js_w_globals=13983e4d05a5657&qcABC=1&ver=240325-42710353
    
    The resource from “https://www.somewebsite.com/wp-content/plugins/s2member/s2member-o.php?ws_plugin__s2member_css=1&qcABC=1&ver=240325-42710353” was blocked due to MIME type (“text/plain”) mismatch (X-Content-Type-Options: nosniff). my-account
    
    The resource from “https://www.somewebsite.com/wp-content/plugins/s2member/s2member-o.php?ws_plugin__s2member_js_w_globals=13983e4d05a5657&qcABC=1&ver=240325-42710353” was blocked due to MIME type (“text/plain”) mismatch (X-Content-Type-Options: nosniff). my-account

    I was pointed to this 13 year old post about s2Member unable to locate WordPress directory which covers the same issue and ultimately has a solution which worked for me. If you scroll to the bottom you will see this:

    The s2member-o.php file is designed to load only the s2Member plugin in a few special situations, in order to conserve system resources. This further optimizes s2Member’s delivery of dynamic CSS/JS files to a browser.

    The s2member-o.php file will look for your root WordPress directory, starting from your s2Member installation directory, and/or from $_SERVER[“SCRIPT_FILENAME”], which is sometimes different.

    The /s2member-o.php file is the only aspect of s2Member with this limitation. If you’d like to avoid this issue all together, you can tell s2Member NOT to use it all. If you’d like to go that route, you can create this directory and file:

    /wp-content/mu-plugins/s2-hacks.php

    <?php
    add_action("ws_plugin__s2member_after_loaded", "s2_hacks"); 

    function s2_hacks() {
            $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["s2o_url"] = site_url("/");
        }
    ?>

    credit: Jason Caldwell 

    I had the mu-plugins/s2-hacks.php file already as well as the function s2_hacks() in use for other things so I simply added that line to the existing function and voila! It worked.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Not a supported MIME type – follow up’ is closed to new replies.