WPML
apply_filters( 'wpml_element_language_details', object $element_object, array $args )
Type
filter
WPML Version
3.2.2

Description

This filter hook will retrieve language information for a translatable element. It queries WPML’s icl_translations database table and returns an object with the element’s trid, source language code and language code.

If you are only looking for the element’s language code you might prefer to use wpml_element_language_code

Arguments

$element_object
(object) (Required) A WordPress object. Defaults to null.
$args
(array) (Required) An array of arguments to be used.
  • element_id(bool) Use term_taxonomy_id for taxonomies, post_id for posts
  • element_type(string) The type of element to check. Can be a post type: post, page, attachment, nav_menu_item, {custom post key} or taxonomy: category, post_tag, nav_menu {custom taxonomy key}

Example usage

Example
$args = array('element_id' => 10, 'element_type' => 'category' );
$my_category_language_info = apply_filters( 'wpml_element_language_details', null, $args );

wpml_post_language_details, wpml_switch_language_for_email, wpml_restore_language_from_email, wpml_switch_language, wpml_element_language_code

All 6 Retrieving Language Information for Content hooks →