Function Reference: geodir_wpml_object_id

Summary

Get the element in the WPML current language.

Parameters

$element_id
(int) (required) Use term_id for taxonomies, post_id for posts.

Default: None
$element_type
(string) (required) Use post, page, {custom post type name}, nav_menu, nav_menu_item, category, tag, etc. You can also pass ‘any’, to let WPML guess the type, but this will only work for posts.

Default: None
$return_original_if_missing
(bool) (required) Optional, default is FALSE. If set to true it will always return a value (the original value, if translation is missing).

Default: None
$language_code
(string|NULL) (required) Optional, default is NULL. If missing, it will use the current language. If set to a language code, it will return a translation for that language code or
the original if the translation is missing and $return_original_if_missing is set to TRUE.

Default: None

Return Values

(int|NULL)

    Change Log

    Since: 1.6.22

    Filters

    ‘wpml_object_id’ [Line: 3210]

    Source File

    geodir_wpml_object_id() is located in geodirectory-functions/custom_functions.php [Line: 3207]

    Source Code

    function geodir_wpml_object_id( $element_id, $element_type = 'post', $return_original_if_missing = false, $ulanguage_code = null ) {
    	if ( geodir_is_wpml() ) {
    		if ( function_exists( 'wpml_object_id_filter' ) ) {
    			return apply_filters( 'wpml_object_id', $element_id, $element_type, $return_original_if_missing, $ulanguage_code );
    		} else {
    			return icl_object_id( $element_id, $element_type, $return_original_if_missing, $ulanguage_code );
    		}
    	}
    
    	return $element_id;
    }