WPML
apply_filters( 'wpml_post_duplicates', int $master_post_id )
类型
filter
WPML 版本
3.2

说明

根据原始文章 ID 返回复制的文章 ID。

参数

$master_post_id
(int) (必填) 存在复制文章的原始文章 ID

使用示例

示例
// $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 );

结果如下所示:
Array
(
    [de] => 30
    [el] => 73
)

如果我尝试传递一个未曾作为原始文章用于创建复制文章的文章 ID,该过滤器将返回一个空数组。为了更清楚地说明这一点,请将下面的示例与上面的示例进行比较。
示例
// 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 );

结果如下:
Array
(
)

wpml_element_translation_type, wpml_is_translated_post_type, wpml_is_translated_taxonomy, wpml_master_post_from_duplicate, wpml_element_has_translations

所有 6 个 查找内容的翻译状态 钩子 →