Last active
April 7, 2021 15:34
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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