Skip to content

Instantly share code, notes, and snippets.

@Pebblo
Last active December 5, 2016 22:42
Show Gist options
  • Save Pebblo/026e24996b32db5590128c86425d685e to your computer and use it in GitHub Desktop.
Save Pebblo/026e24996b32db5590128c86425d685e to your computer and use it in GitHub Desktop.
An example of how to remove scripts from the EE Event/Venue pages. Currently this removes the Januas 'cmb-scripts' script file.
<?php //Do not include the opneing PHP tag if you already have one.
//This functions can be used to remove scripts loaded by other plugins (or the sites theme) on EE Event/Venue pages.
function tw_ee_remove_scripts_from_event_editor( $hook_suffux ){
$page = isset( $_GET['page'] ) ? $_GET['page'] : '';
$action = isset( $_GET['action'] ) ? $_GET['action'] : '';
if ( ( $hook_suffux == 'post.php' || $hook_suffux == 'post-new.php' ) && ( $page == 'espresso_events' || $page == 'espresso_venues' ) && ( $action == 'edit' || $action == 'create_new' ) ) {
//This is an EE Event/Venue page, add scripts to remove in thi block
wp_deregister_script( 'cmb-scripts' );
}
}
add_filter( 'admin_enqueue_scripts', 'tw_ee_remove_scripts_from_event_editor', 20, 1 );
<?php //Do not include the opneing PHP tag if you already have one.
//@JoshFeck used a different method in the forum thread which completely removes the action added by Januas theme:
function tw_ee_remove_scripts_from_event_editor(){
remove_action( 'admin_enqueue_scripts', 'cmb_scripts', 10 );
}
add_action( 'add_meta_boxes_espresso_events', 'tw_ee_remove_scripts_from_event_editor' );
@Pebblo
Copy link
Author

Pebblo commented Dec 5, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment