Skip Navigation
availability:

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

type:
filter
category:
Retrieving Language Information for Content
parameters:
apply_filters( 'wpml_element_language_details', object $element_object, array $args )
$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}
hook example usage:

Example

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