function saveImageTags() { $result = false; if (isset($_POST['image_tags_nonce']) && wp_verify_nonce($_POST['image_tags_nonce'], 'image_tags')) { $image_id = $_POST['image_id']; $building_id = $_POST['building_id']; $user_id = $_POST['user_id']; if (empty($_POST['image_tags'])) { $image_tags = []; } else { $image_tags = explode(",", $_POST['image_tags']); } $result = Idp_Main::setImageTags($building_id, $image_id, $image_tags, $user_id); } if ($result !== false) { echo "<span class=\"glyphicon glyphicon-ok\" aria-hidden=\"true\" title=\"Tags gespeichert\"></span>"; } else { echo "<span class=\"glyphicon glyphicon-remove-sign\" aria-hidden=\"true\" title=\"Fehler\"></span>"; } wp_die(); // this is required to terminate immediately and return a proper response }