Please make sure to update to WPML 4.3.5 and check our list of Known Issues before reporting

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 8 replies, has 2 voices.

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

Assigned support staff: Carlos Rojas.

Author Posts
August 24, 2018 at 3:31 pm #2673672

sergeyS-14

Hi there!

Any chance i can just rewrite the url in language switcher to redirect it to just domain language without any other parts of url?

May be i can add_filter some value to force url of certain taxonomy to be like hidden link...) like so?

If i have myweb.com(com,es,fr...)/my_taxonomy/name_taxonomy to myweb.com(com,es,fr...) only?

Thank you!

August 25, 2018 at 12:00 am #2674402

Carlos Rojas
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/Madrid (GMT+01:00)

Hello,
Thank you for contacting WPML support.

This is not possible within WPML functionalities, however I recommend you to visit this links that might be helpful:
- https://wpml.org/documentation/support/wpml-coding-api/wpml-hooks-reference/
- https://wpml.org/documentation/getting-started-guide/language-setup/custom-language-switcher/
- https://wpml.org/documentation/getting-started-guide/language-setup/designing-custom-language-switchers-using-template-files/

Also, think in the possibility to use a redirection plugin. In this link you will find redirection plugins compatible with WPML: https://wpml.org/documentation/plugins-compatibility/

Kind regards,
Carlos

August 27, 2018 at 12:57 pm #2678159

sergeyS-14

I found to get it by this way:

add_filter( 'wpml_ls_language_url', 'fix_url', 10 ,2 );

function fix_places_url( $langs,$data) {

    global $wp_query;

    if (isset ($wp_query->tax_query->queried_terms['property_city']) 
            && isset ($wp_query->tax_query->queried_terms['property_type']) ) {
        
        $pre_url = '<em><u>hidden link</u></em>.';
        $post_url = '/';  //<-- HERE i wold like to put my own part in the future
                
        if ('es' == $data[code]){

            return $pre_url.'es'.$post_url;

        }elseif('en' == $data[code]){

            return $pre_url.'com'.$post_url;

        }elseif('ru' == $data[code]){

            return $pre_url.'ru'.$post_url;

        }elseif('fr' == $data[code]){

            return $pre_url.'fr'.$post_url;

        }
    
    return $langs;
}

Let me know if there is the bettrer way to do the same?

-----------------------------------------------------------

And another thing its about hreflang:

here: https://wpml.org/documentation/support/adding-hreflang-wordpress/

It say how to on/off this lines:

<link rel="alternate" hreflang="en" href="<em><u>hidden link</u></em>" />
<link rel="alternate" hreflang="ru" href="<em><u>hidden link</u></em>" />
<link rel="alternate" hreflang="fr" href="<em><u>hidden link</u></em>" />

So i need to make same changes... what hook i can use?

Thank you.

August 27, 2018 at 6:10 pm #2679640

Carlos Rojas
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/Madrid (GMT+01:00)

Hi,

The code you posted in your previous message looks correct, however it seems -unfortunately- that for now you need custom programming work which is beyond the scope of our support.

At this point I would suggest you consider contacting one of our certified partners from this link: http://wpml.org/documentation/support/wpml-contractors/

Before doing so please have a look also here:
http://wpml.org/documentation/support/wpml-contractors/guidelines-for-people-looking-for-consulting-help/

You will get the custom assistance you need to get on with your project.

Best regards,
Carlos

August 29, 2018 at 2:21 pm #2686708

sergeyS-14

So you tell me there is no any way to change the hreflang? Cant be...

Please let me know if there is some way to change urls of hreflang. If you dont know about it please, ask another level of support.

All what i need its the right filter or hook to change the Url of hreflang. Because the WPML plugin is responsable of that behavior.

Thank you.

August 29, 2018 at 5:37 pm #2687544

Carlos Rojas
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/Madrid (GMT+01:00)

Hi,

To change the hreflang you need to go to WPML -> Languages -> Edit the languages -> Change the value in the hreflang column.

Please visit this link where you will find our official documentation about this subjet:
https://wpml.org/documentation/support/adding-hreflang-wordpress/#check-your-hreflang-settings-and-make-sure-they-are-as-you-intend-them-to-be

Please let me know if you need further help.
Best regards,
Carlos

August 30, 2018 at 2:37 pm #2690712

sergeyS-14

I mean change hreflang URL programatically using filter or hook of WPML if there is any.

August 30, 2018 at 8:18 pm #2691836

Carlos Rojas
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/Madrid (GMT+01:00)

Hi,

The closest I have found is a filter called wpml_hreflang, please visit this post for more information: https://wpml.org/forums/topic/hook-for-custom-hreflang/#post-1515739

Does this works for you?

Best regards
Carlos

August 31, 2018 at 3:58 pm #2694533

sergeyS-14

Thank you very much! I hope next time you can understand me better.