WPML
SignaturePHP
apply_filters( 'wpml_element_language_details', object $element_object, array $args )

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_objectobjectRequired

    A WordPress object. Defaults to null.
  • $argsarrayRequired

    An array of arguments to be used.
    • element_idbool

      Use term_taxonomy_id for taxonomies, post_id for posts
    • element_typestring

      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

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