/** * Ajax handler for previewing potentially untranslated terms on a posts, * the language of which is about to be changed and whose connection to the post * will therefore be lost. */ public static function wpml_before_switch_post_language() { $to = false; $post_id = false; $nonce = filter_input(INPUT_POST, '_icl_nonce'); if (!wp_verify_nonce($nonce, 'wpml_switch_post_lang_nonce')) { wp_send_json_error('Wrong Nonce'); } $result = false; if (isset($_POST['wpml_to'])) { $to = $_POST['wpml_to']; } if (isset($_POST['wpml_post_id'])) { $post_id = $_POST['wpml_post_id']; } if ($to && $post_id) { $result = WPML_Terms_Translations::get_untranslated_terms_for_post($post_id, $to); if (empty($result)) { $result = false; } } wp_send_json_success($result); }
/** * Ajax handler for previewing potentially untranslated terms on a posts, * the language of which is about to be changed and whose connection to the post * will therefore be lost. */ public static function wpml_before_switch_post_language() { $to = false; $post_id = false; $result = false; if (isset($_POST['wpml_to'])) { $to = $_POST['wpml_to']; } if (isset($_POST['wpml_post_id'])) { $post_id = $_POST['wpml_post_id']; } if ($to && $post_id) { $result = WPML_Terms_Translations::get_untranslated_terms_for_post($post_id, $to); if (empty($result)) { $result = false; } } wp_send_json_success($result); }