Archived topic
Elements hook for WPML
3 replies · Started by Stephan on February 15, 2019
Hello,
I have a problem with automatic WPML translations of links to pages in another language.
In the WPML forum, I found this solution. I should insert into functions.php:
add_filter( 'wpml_sl_blacklist_requests', 'wpml_sl_blacklist_requests', 10, 2 );
function wpml_sl_blacklist_requests( $blacklist, $sitepress ) {
$blacklist[] = 'documentation';
return $blacklist;
}
As far as I understand, the Elements (hooks) are designed for exactly the purpose that we do NOT need to edit the functions.php.
I tried a bit in Elements (I have already other elements working well) but no success.
Can you tell me how exactly I can get the above code to work with an element?
Thanks
Stephan
Hi there,
That function can't be added as a Hook, unfortunately.
You'd have to add it using one of these methods: https://docs.generatepress.com/article/adding-php/
Hi Tom,
I did not want to install one more plugin which interferes with the theme. Also, it is not sure that this hook would work.
For now I found a different solution for this WPML problem, using the direct link by page id. Also, I can't believe that there is no option in WPML which resolves that, so I asked them in the forum.
Many thanks for your always quick support!
Stephan
Glad you found a solution :)