Skip to content

Instantly share code, notes, and snippets.

// 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 = [];
@razvan-translatepress
razvan-translatepress / remove-translatepress-hooks-in-theme.php
Last active July 3, 2023 10:32
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.