Skip to content

Commit

Permalink
Tab Manager: Update snippet to avoid fatals when plugin not active
Browse files Browse the repository at this point in the history
  • Loading branch information
tamarazuk committed May 4, 2018
1 parent e56ccca commit da0f8ec
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions woocommerce-tab-manager/remove-tabs-from-site-search.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
<?php // only copy if needed

/**
* Completely removes product tab content from the site search
*/

// Completely removes product tab content from the site search
remove_filter( 'posts_clauses', array( wc_tab_manager()->get_search_instance(), 'modify_search_clauses' ), 20, 2 );
function sv_wc_tab_manager_disable_tab_search() {

// bail if Tab Manager isn't active
if ( ! function_exists( 'wc_tab_manager' ) ) {
return;
}

remove_filter( 'posts_clauses', array( wc_tab_manager()->get_search_instance(), 'modify_search_clauses' ), 20 );
}
add_action( 'init', 'sv_wc_tab_manager_disable_tab_search' );

0 comments on commit da0f8ec

Please sign in to comment.