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
/* 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. |
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
// list of urls in default language for which you need the equivalent in all languages | |
$product_feed_url_list_in_default_language = [ 'http://example.com/product1', 'http://example.com/product2' ]; | |
$trp = TRP_Translate_Press::get_trp_instance(); | |
$trp_settings = $trp->get_component( 'settings' ); | |
$settings = $trp_settings->get_settings(); | |
$url_converter = $trp->get_component( 'url_converter' ); | |
$translated_urls = []; |