the post's language ('language_code') * - wpml_language_is_active -> whether one given language is active; * unlike wpml_active_languages it does not depend on the main query, * so it is safe during REST target collection. * * @param int $post_id Post ID. * @return bool */ public static function post_language_is_inactive( int $post_id ): bool { if ( ! self::is_active() ) { return false; } // This post's language. // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- WPML filter name. $details = apply_filters( 'wpml_post_language_details', null, $post_id ); $code = is_array( $details ) ? (string) ( $details['language_code'] ?? '' ) : ''; if ( '' === $code ) { return false; } // Ask WPML about this one language. Only an explicit boolean "not // active" answer drops the post; null or anything else means WPML // did not answer, and the post stays in the scan. // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- WPML filter name. $is_active = apply_filters( 'wpml_language_is_active', null, $code ); return false === $is_active; } } Acceguru_Compat_WPML::init();