availability:

WPML Version: 3.3.5

description:
  • Get trid (the ID of the translation group) of a translated element, which is required for the  wpml_get_element_translations filter and others which expect this argument.
  • Learn more about trid on the WPML’s tables documentation page.
type:
filter
category:
Site-Wide Language Information
parameters:
apply_filters( 'wpml_element_trid', mixed $empty_value, integer $element_id, string $element_type)
$empty_value
(mixed) (Required) This is usually the value the filter will be modifying. We are not filtering anything here so set this to NULL. This is needed for the filter function to actually receive the full argument list.
$element_id
(integer) (Required) The ID of the item (post_id for post types, term_taxonomy_id for taxonomy terms).
$element_type
(string) (Optional) The type of an element. Can be a post type: post_post, post_page, post_attachment, post_nav_menu_item, post_{custom post key} or taxonomy: tax_category, tax_post_tag, tax_nav_menu, tax_{custom taxonomy key}. Defaults to post_post if not set.
hook example usage:

Example

// Get "trid" of the "Sample Page" page. 
$trid = apply_filters( 'wpml_element_trid', NULL, 2, 'post_page' );