apply_filters( 'wpml_post_duplicates', int $master_post_id )
- Type
- filter
- WPML Version
- 3.2
Description
Returns the duplicated post IDs from the original post ID.
Arguments
- $master_post_id
- (int) (Required) The original post id from which duplicates exist
Example usage
Example
// $my_duplications will return an associative array with language codes as indexes and post_ids as values $my_duplications = apply_filters( 'wpml_post_duplicates', 28 );
The result looks like this:
Array
(
[de] => 30
[el] => 73
)
If I attempt to pass a post ID that has not been used as the original post to create duplicates from the filter will return an empty array. To illustrate this more clearly please compare the example below to the one given above.
Example
// note that I use post ID 30 This is the German duplicated post from the first example above $my_duplications = apply_filters( 'wpml_post_duplicates', 30 );
And the result:
Array ( )
Related hooks
wpml_element_translation_type, wpml_is_translated_post_type, wpml_is_translated_taxonomy, wpml_master_post_from_duplicate, wpml_element_has_translations