apply_filters( 'wpml_element_has_translations', mixed $empty_value, int $element_id, string $element_type )
- タイプ
- filter
- カテゴリー
- コンテンツの翻訳状態の確認
- WPMLバージョン
- 3.2
説明
投稿タイプまたはタクソノミータームが翻訳されているかどうかに応じて、TRUEまたはFALSEを返します。
引数
- $empty_value
- (mixed) (必須) これは通常、フィルターが変更する値です。ここでは何もフィルタリングしないため、これをNULLに設定します。これは、フィルター関数が完全な引数リストを実際に受け取るためです。
- $element_id
- (int) (必須) 情報を取得する要素のIDです。タクソノミータームにはterm_idを、投稿タイプにはpost_idを使用します。
- $element_type
- (string) (必須) IDが属する要素のタイプです。投稿タイプ(post、page、attachment、nav_menu_item、{custom post key})またはタクソノミー(category、post_tag、nav_menu、{custom taxonomy key})を指定できます。
使用例
例
//$is_translated will be TRUE if the custom post is translated and FALSE if it is not translated $is_translated = apply_filters( 'wpml_element_has_translations', NULL, 61, 'book' )
関連するフック
wpml_element_translation_type, wpml_is_translated_post_type, wpml_is_translated_taxonomy, wpml_master_post_from_duplicate, wpml_post_duplicates