2016-05-31 2 views
0

私は開発中のプラグインの中で、いくつかの画像をWordPressデータベースに保存しようとしています(チュートリアルの助けを借りて - 私の 'スライダー'ポストタイプを保存しようとすると、次の画面が表示されます):WordPressのカスタムポストタイプを使用して画像を保存しますか?

enter image description here

これは、コード..

add_action('save_post', 'fwds_save_slider_info'); 

function fwds_save_slider_info($post_id) { 

    // verify nonce 

    if (isset($_POST['fwds_slider_box_nonce']) && !wp_verify_nonce($_POST['fwds_slider_box_nonce'], basename(__FILE__))) { 
     return $post_id; 
    } 
    // check autosave 
    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { 
     return $post_id; 
    } 
    // check permissions 
    if ('slidesjs_slider' == isset($_POST['post_type']) && current_user_can('edit_post', $post_id)) { 

     /* Save Slider Images */ 

     print_r($_POST['gallery_img']);exit; 

     $gallery_images = (isset($_POST['gallery_img']) ? $_POST['gallery_img'] : ''); 

     $gallery_images = strip_tags(json_encode($gallery_images)); 

     update_post_meta($post_id, "_fwds_gallery_images", $gallery_images); 

    } else { 
     return $post_id; 
    } 
} 

私は戻って、私は、保存のスライダーを表示すると、画像が消えている。私は翔をthinkyou

答えて

0

私がここで間違って何をやっています? ldはこれを削除しますprint_r($ _ POST ['gallery_img']);終了;

関連する問題