Skip Navigation
availability:

WPML Version: 3.2

description:

Returns the duplicated post IDs from the original post ID.

type:
filter
category:
Finding the Translation State of Content
parameters:
apply_filters( 'wpml_post_duplicates', int $master_post_id )
$master_post_id
(int) (Required) The original post id from which duplicates exist
hook 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
(
)