Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save razvan-translatepress/8b102c1514c15ac092ccdade05c02dff to your computer and use it in GitHub Desktop.
Save razvan-translatepress/8b102c1514c15ac092ccdade05c02dff to your computer and use it in GitHub Desktop.
Remove TranslatePress hooks in functions.php of theme
/* This particular code example refers to removing the TranslatePress search capability in secondary languages. */
// Use a different hook if 'init' is not executed early enough
add_action('init', 'trpc_remove_search_hook');
function trpc_remove_search_hook(){
$trp = TRP_Translate_Press::get_trp_instance();
// fetch the component needed by replacing 'search' with the name of the component. Name of all components are found in class-translatepress.php
$trp_search = $trp->get_component('search');
// Use default WordPress function remove_filter or remove_action. Make sure to specifiy priority too.
remove_filter('pre_get_posts', array($trp_search,'trp_search_filter'), 99999999 );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment