apply_filters( 'wpml_original_element_id', mixed $empty_value, integer $element_id, string $element_type)
Description
- Returns the ID of the original language post or page when given the ID of its translation.
Arguments
$empty_valuemixedRequiredThis 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_idintegerRequiredThe ID of the item (post_id for post types, term_taxonomy_id for taxonomy terms).$element_typestringOptionalThe 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 topost_postif not set.
Example Usage
Example
// Get the original post ID of a translated page. $original_id = apply_filters( 'wpml_original_element_id', NULL, 6, 'post_page' );