Support » Plugin: Autoptimize » Exclude JS/CSS issues

  • Resolved joym

    (@joymoleta)


    Hello, thank you for creating such a great plugin. I’m having a bit of a problem with the exclusion setting. I am trying to exclude a plugin from optimization, but it’s just not working. I have followed your example and have tried: plugins/onlinecontract and plugins/onlinecontract/js. Neither of these options work. I’ve had to turn off JS and CSS optimization for this plugin to properly work. I’m not sure if you can help or provide any insight but I would very much like to use your plugin to the best of it’s ability. Thank you.

    https://wordpress.org/plugins/autoptimize/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Frank Goossens

    (@futtta)

    Difficult to say … If you can provide me with a link to an Autoptimized page where it doesn’t work as it should (here or via futtta-at-gmail-dot-com), I’ll have a quick look.

    frank

    Plugin Author Frank Goossens

    (@futtta)

    For future reference, the problem was due to the fact that the contracts-plugin does some pretty … nifty things such as e.g. writing the html-tag out in javascript and that utterly confuses Autoptimize.

    Anyone encountering this problem can easily exclude contracts from optimization by using this Autoptimize API-based code (assuming a page with a contract has “contract=” in the URL):

    add_filter('autoptimize_filter_noptimize','contracts_ao_noptimize',10,0);
    function contracts_ao_noptimize() {
      if (strpos($_SERVER['REQUEST_URI'],'contract=')!==false) {
       return true;
      } else {
       return false;
      }
    }

    Thanks to Joy for testing & confirming!

    frank

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Exclude JS/CSS issues’ is closed to new replies.