Skip Navigation

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

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

Assigned support staff: Carlos Rojas.

Author Posts
September 5, 2018 at 2:19 pm #2707533

sergeyS-14

I am on taxonomy or on post_type page (not on default one).

I wold like to get all urls or ID for all translations of current page?

If there is a way to get translated pages?

May be some WPML hook or filter to use for it?

For example:
I got current taxonomy(or post_type) in spanish and the current id is 123

Planing to use with combine of WPML hook "wpml_hreflangs" to change hreflang urls on page:

//not real code, just example i think it may be ok

add_filter( 'wpml_hreflangs', 'hrefs_manipulator_callback' );

function hrefs_manipulator_callback(){
	
$obj_id = get_the_ID();

global $sitepress;

//get_all_translations($obj_id); is function i guessing to be exist

$translations_array = $sitepress->get_all_translations($obj_id);

	foreach ($translations_array as $translation) {
		//do stuff with tranlatinos
	}
}
September 5, 2018 at 3:06 pm #2707755

Carlos Rojas
Supporter

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

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

Hello,
Thank you for contacting WPML support.

In this link you will find a list of all hooks documented by WPML: https://wpml.org/documentation/support/wpml-coding-api/wpml-hooks-reference/

Kind regards,
Carlos

September 7, 2018 at 1:18 pm #2714861

sergeyS-14

i can read docs by my self... i suppose the support know the necessary hooks. I hope you will inform better and next time answer will be useful.