• Resolved WPWanderer

    (@wpwanderer)


    Hi, looking at your api I saw that you could turn off AO by page Url (if I understood it correctly).

    However, is there a way to not aggregate JS on a particular page? I do understand you can do it by variable, but there is a pesky page that is giving me some problems (ajax pagination) and I would like to completely not aggregate JS for this results page.

    Thanks.

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

    (@futtta)

    sure, try something like this, assuming you want to exclude a page with “pesky_page/” in the URL;

    add_filter('autoptimize_filter_js_noptimize','wpw_noptimize');
    function wpw_noptimize() {
    	if (strpos($_SERVER['REQUEST_URI'],'pesky_page/')!==false) {
    		return true;
    	} else {
    		return false;
    	}
    }

    hope this helps,
    frank

    Thread Starter WPWanderer

    (@wpwanderer)

    I’ve actually been using: “<!–noptimize–><!–/noptimize–>” to deactivate AO on some of my page templates where I am calling in something like a gravity form. I just surround entire PHP sections. It seems to work.

    Let me know if this is not advisable.

    Plugin Author Frank Goossens

    (@futtta)

    that’s one of the many ways you can exclude stuff from autoptimization yeah 🙂

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

The topic ‘not aggregate JS on certain pages?’ is closed to new replies.