apply_filters( 'wpml_original_element_id', mixed $empty_value, integer $element_id, string $element_type)
- Type
- filter
- Category
- Site-Wide Language Information
- WPML Version
- 3.2
Description
- Returns the ID of the original language post or page when given the ID of its translation.
Arguments
- $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_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' );
Related hooks
wpml_decode_custom_field, wpml_footer_language_selector, wpml_add_language_form_field, wpml_ls_exclude_in_menu, wpml_is_rtl, wpml_alternate_hreflang, wpml_head_langs, wpml_must_translate_canonical_url, wpml_browser_redirect_language_params, wpml_active_languages