public static function optimizeImages() { if (!empty($_POST['post_id']) && !empty($_POST['img_post_id'])) { $post_id = intval($_POST['post_id']); $img_post_id = intval($_POST['img_post_id']); if (!empty($_POST['img_exclude'])) { $img_exclude = $_POST['img_exclude']; } else { $img_exclude = array(); } $ret = ImageHelper::_optimizeImages($post_id, $img_post_id, $img_exclude); } else { $ret = array('success' => false, 'msg' => __('The post is not existed, please choose one another!', 'wp-meta-seo')); } echo json_encode($ret); wp_die(); }