Plugin Author
Chouby
(@chouby)
Hello,
The only way is to code your own links model (a child class of PLL_Links_Model) then you use the filter filter ‘pll_links_model’ to tell Polylang to use your class: https://github.com/polylang/polylang/blob/0414f634dbee60f589755d3a2e7dcc65d62203b4/include/model.php#L584-L592
You’ll need to make sure that all methods such as add_language_to_link(), remove_language_from_link(), get_language_from_url() are correctly defined. You can look at other child classes to get some inspiration.
Thank you very much for your answer.
Is there also a way to disable hreflang tags gennerated with polylang? I ask because i would like to use another plugin to control those more granularly, but I fear it would conflict with Polylang generated hreflang tags.
How can I disable hreflang tags with polylang?
I’ve solved the disabling of hreflang tags by searching in this support section, so I’ve done this:
– created a child theme
– added this line at the end of the funtions.php file:
remove_filter( 'pll_rel_hreflang_attributes', 'filter_pll_rel_hreflang_attributes', 10, 1 );
I’ve then installed the HREFLANG Tags Lite plugin, to make it easier to managed hreflang tags for every page and post.
Actually, turns out i can’t manage to disable hreflang tags with that filter, polylang just ignores it somehow.
Advice would be appreciated, I skimmed the polylang filters documentation and it requires a non-negligible degree of technical proficiency…
Just how to disable all hreflangs polylang throws in?
Thanks.
-
This reply was modified 5 years, 9 months ago by
jasurdeury.
Nothing?
Isn’t there an easy stp-by-step guide to disable hreflang tags in polylang? The usual method (written above) doens’t work.