Skip to content

Instantly share code, notes, and snippets.

@joshfeck
Last active June 26, 2018 15:17
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshfeck/b625f638c6096da4a7429ffe1931a6a0 to your computer and use it in GitHub Desktop.
Save joshfeck/b625f638c6096da4a7429ffe1931a6a0 to your computer and use it in GitHub Desktop.
Remove unneeded scripts, stylesheets, and fonts from loading on the EE4 transactions page. This will reduce the number of http requests. Useful for payment methods like Authnet SIM that post to the Transactions page. Since the Transactions page isn't displayed in the registration process it doesn't need to look pretty.
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
add_action('template_redirect', 'my_simple_ee_transactions_page');
function my_simple_ee_transactions_page() {
if(class_exists('EE_Registry')) {
if(isset(EE_Registry::instance()->CFG->core->txn_page_id)) {
if(is_page(EE_Registry::instance()->CFG->core->txn_page_id)) {
remove_all_actions('wp_enqueue_scripts');
remove_all_actions('wp_head');
remove_all_actions('wp_footer');
}
}
}
}
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
//* Version for Event Espresso 3 sites
add_action('template_redirect', 'my_simple_ee_three_transactions_page');
function my_simple_ee_three_transactions_page() {
$org_options = get_option('events_organization_settings');
if (!empty($org_options['notify_url'])) {
if(is_page($org_options['notify_url'])) {
remove_all_actions('wp_enqueue_scripts');
remove_all_actions('wp_head');
remove_all_actions('wp_footer');
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment