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