Support » Plugin: Popup, Optin Form, Email Newsletters for MailChimp, AWeber, HubSpot - MailOptin » [CONTRIBUTION] All admin css and js not found in Windows

  • Resolved diegosomar

    (@diegosomar)


    I’m using Windows 10 in localhost. After installing, all css and js within admin is broken. See the JS example URL:

    http://localhost/my-site/wp-content/plugins/mailoptinvendormailoptincoresrc/assets/tooltipster/light.min.css?ver=1.2.12.1

    It’s happen because in Windows, the path separator is backslash (__FILE__ constant). When WordPress load the scripts, the backslash is removed.

    To solve this, add this code to your theme functions.php:

    
    add_filter( 'script_loader_src', '8792359_adjust_backslash_scripts', 99, 2 );
    add_filter( 'style_loader_src',  '8792359_adjust_backslash_scripts', 99, 2 );
    function 8792359_adjust_backslash_scripts( $src, $handle ){
      $src = str_replace("\\", "/", $src);
      return $src;
    }
    

    This force WordPress to change the backslash in URLs to normal slash and solve the problem. I suggest to the authors to change the plugin constants, replacing backslashes to normal slashes.

Viewing 3 replies - 16 through 18 (of 18 total)
Viewing 3 replies - 16 through 18 (of 18 total)
  • The topic ‘[CONTRIBUTION] All admin css and js not found in Windows’ is closed to new replies.