Skip to content

Instantly share code, notes, and snippets.

@Pebblo
Last active April 7, 2021 15:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pebblo/baaee6d732ea5e0326a927ae816892ef to your computer and use it in GitHub Desktop.
Save Pebblo/baaee6d732ea5e0326a927ae816892ef to your computer and use it in GitHub Desktop.
This removes the SearchWP callback from 'add_meta_boxes' when viewing only the Event Espresso admin pages. SearchWP has a type declation of string on $post_type, on the EE admin pages it is null.
<?php //Please do not include the opening PHP tag if you already have one.
add_action('AHEE__EE_Admin_Page___display_admin_page__modify_metaboxes', 'tw_ee_remove_searchwp_from_ee_admin_pages', 10);
function tw_ee_remove_searchwp_from_ee_admin_pages() {
if(class_exists('SearchWP')) {
$searchwp = new SearchWP();
$searchwp_sources = $searchwp->get_sources();
if(!empty($searchwp_sources['post.attachment'])) {
remove_action('add_meta_boxes', array($searchwp_sources['post.attachment'], 'document_content_meta_box'), 10);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment