コード例 #1
0
ファイル: takeaway.php プロジェクト: ankitparsanaa/foodapp
 public function takeaway_settings()
 {
     $post_id = $_POST['post_id'];
     if (isset($post_id)) {
         $data = json_encode($_POST['items']);
         update_post_meta($post_id, 'takeaway_settings', $data);
         $meta_id = get_mid_by_key($post_id, 'takeaway_settings');
         $result = array('success' => true, 'meta_id' => $meta_id, 'data' => $data);
     } else {
         $result = array('error' => true);
     }
     echo json_encode($result);
     wp_die();
 }
コード例 #2
0
 public function atmf_save_metadata()
 {
     $save_data = json_encode($_POST['save_data'], JSON_NUMERIC_CHECK);
     if (!empty($_POST['save_data']['page_id'])) {
         if (json_decode($save_data) != null) {
             $store_it = update_post_meta($_POST['save_data']['page_id'], 'search_page', $save_data);
         }
     }
     if (isset($store_it)) {
         $meta_id = get_mid_by_key($_POST['save_data']['page_id'], 'search_page');
         $return = array('success' => true, 'meta_id' => $meta_id, 'save_data' => $save_data);
     } else {
         $return = array('error' => true);
     }
     $result = array();
     $result['data'] = $return;
     //wp_send_json_success($return);
     echo json_encode($result, JSON_NUMERIC_CHECK);
     wp_die();
 }