S
S
sputnickk2021-08-30 10:39:25
Internationalization and localization
sputnickk, 2021-08-30 10:39:25

How to remove the language code for a specific page (polylang plugin)?

Hello! Googled, I found this code to solve this problem:

function filter_pll_check_canonical_url( $redirect_url, $language ) {
   $redirect_url = str_replace('en', '', $redirect_url);
}
add_filter( 'pll_check_canonical_url', 'filter_pll_check_canonical_url', 10, 2 );


I just can't figure out how to apply this code to a specific page.

while such chaotic thoughts:
function filter_pll_check_canonical_url( $redirect_url, $language ) {
//если $redirect_url не пустой {
если $redirect_url == слугу моей страницы {
   $redirect_url = str_replace('en', '', $redirect_url);
команда редиректа....
}
}
}


Anyone in the know, tell me please

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question