ACF_WPML_Compatibility::verify_ajax()publicACF 5.2.3

verify_ajax

Sets the correct language during AJAX requests.

Метод класса: ACF_WPML_Compatibility{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$ACF_WPML_Compatibility = new ACF_WPML_Compatibility();
$ACF_WPML_Compatibility->verify_ajax();

Список изменений

С версии 5.2.3 Введена.

Код ACF_WPML_Compatibility::verify_ajax() ACF 6.0.4

function verify_ajax() {

	// phpcs:disable WordPress.Security.NonceVerification.Recommended -- Verified elsewhere.
	// set the language for this AJAX request
	// this will allow get_posts to work as expected (load posts from the correct language)
	if ( isset( $_REQUEST['lang'] ) ) {
		global $sitepress;
		$sitepress->switch_lang( sanitize_text_field( $_REQUEST['lang'] ) );
	}
	// phpcs:enable WordPress.Security.NonceVerification.Recommended
}