Please make sure to update to WPML 4.3.4 before reporting any issue

Hi, Amit here, I am the WPML Support Manager, our current ticket queue is high, update your WPML plugins and make sure you meet the minimal requirements for running WPML before reporting an issue please - many tickets are resolved doing that

Please look at our updated list of Known Issues and you can also use our support search to find helpful information and of course review our documentation before opening a ticket.

If you do need to open a ticket please make sure to provide us with all the needed information as described in this page

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 4 replies, has 2 voices.

Last updated by sergeyS-14 1 year, 7 months ago.

Assigned support staff: Yuri.

Author Posts
April 11, 2018 at 3:59 pm #1598761

sergeyS-14

I have custom type and custom taxonomies (property_area, property_city, property_type )

So i extend the existent rewrite rules to get posts by additional rules:
<?php

add_filter( 'rewrite_rules_array', 'property_type_add_rewrite_rules' );

function property_type_add_rewrite_rules( $wp_rewrite ) {

$new = array();

$new['property-type/([^/]+)/([^/]+)/(.+)/?$'] = 'index.php?property_type=$matches[1]&property_city=$matches[2]&property_area=$matches[3]';
$new['property-type/([^/]+)/(.+)/?$'] = 'index.php?property_type=$matches[1]&property_city=$matches[2]';
$new['property-type/(.+)/?$'] = 'index.php?property_type=$matches[1]';

return array_merge( $new, $wp_rewrite ); // Ensure our rules come first

}

?>

Old url was:
hidden link

After i add city or/and area its look like this:
hidden link

So in menu the Language Switcher still have old links, and i wold like to modify his links to

How i can do this? Or may be there is another way (if this one is not correct) to get this links of Language Switcher modified?

April 12, 2018 at 12:53 am #1603015

Yuri

Hi, you can use the filter "wpml_ls_language_url" that will rewrite the URL used on the Language switcher and manipulate it that way. You can see it being called on the file /wp-content/plugins/sitepress-multilingual-cms/classes/language-switcher/class-wpml-ls-model-build.php @ line 115

Let me know if this is what you were looking for.

April 23, 2018 at 4:52 pm #1773951

sergeyS-14

Great seem like this is it! I Will try soon and change the question to resolved.

Another similar, may be the same answer, question (let me know if need to create separate ticket):

We have configured WPML as different domain for language.
How the WPML do the redirect between domains?
There is some filter or hook we can use to check and redirect if needed?

I am asking because we planing to change the names in url structure so i need to cactch this some how trough hooks or filter i believe.

Thank you!

April 26, 2018 at 4:44 pm #1840929

sergeyS-14

Thank you this is it.

June 12, 2018 at 1:41 pm #2408434

sergeyS-14

One more thing, is this possible to get same as the filter "wpml_ls_language_url" but for all languages? Because i can see only current one...