Fetch ID’s associated with a custom post type when translated with WPML?

I’ve created a custom post type (roomtype). Now these roomtypes has post id 272 (single room in swedish) and 350 (double room in swedish)
I’ve made it translatable (with WPML) and created in english. When I create new roomtypes with different languages (english) they get other id’s: like 405 (single room) and 470 (double room)

I want to check some things in db and I make comparision against the roomtype-id for example single room.

Something like this:

//Check single room (both languages)
if ( $roomtype_id == 272 || $roomtype == 405 ) {
//do action
}

//Check double room (both languages)
if ( $roomtype-id = 350 || $roomtype_id == 470 ) {
//do action
}

How can I fetch the ID’s associated with roomtype custom type indepently of language?

Read more here:: Fetch ID’s associated with a custom post type when translated with WPML?

Leave a Reply

Your email address will not be published. Required fields are marked *