Skip Navigation
availability:

WPML Version: 3.2

description:
  • Returns the ID of the original language post or page when given the ID of its translation.
type:
filter
category:
Site-Wide Language Information
parameters:
apply_filters( 'wpml_original_element_id', 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 the original post ID of a translated page.
$original_id = apply_filters( 'wpml_original_element_id', NULL, 6, 'post_page' );