Support

Home Forums Event Espresso Premium Disable scripts on non Event Espresso pages

Disable scripts on non Event Espresso pages

Posted: March 4, 2020 at 9:15 am

Viewing 1 reply thread


madeuk

March 4, 2020 at 9:15 am

At present all Event Espresso scripts and CSS files are being loaded on every page of our site. How can we ensure they are only loaded on event pages? We’ve tried using the below filter but that isn’t working.

add_filter('FHEE_load_js', '__return_false')


Josh

  • Support Staff

March 4, 2020 at 12:50 pm

Hi,

If you’re not using the attendee block anywhere on the site, you could add the following:

add_action(
 'init',
 'madeuk_conditional_load_block_assets',
 9
);

function madeuk_conditional_load_block_assets() {
    add_filter('FHEE__EE_System__canLoadBlocks', '__return_false');
}

You can add the above to a functions plugin or, if available, into your WordPress child theme’s functions.php file.

Viewing 1 reply thread

The support post ‘Disable scripts on non Event Espresso pages’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso