如何在Wordpress中为“ post_category”设置多个复选框?

时间:2019-05-05 09:26:20

标签: php wordpress checkbox wordpress-theming bots

我想;选中Cat 1, Cat 2, Cat 3复选框后,在bot.php上写到'post_category' => category id

like =  'post_category' => 1,2,3,4

对不起,我英语不好。谢谢

这是我的index.php代码

<form action="bot.php" method="POST">
 <fieldset>
  <legend>Kategori</legend><br/>
  <input name="deger[]" type="checkbox" id="deger" value="1"  tabindex="20"/> Cat 1  
  <input name="deger[]" type="checkbox" id="deger" value="2"  tabindex="20"/> Cat 2   
  <input name="deger[]" type="checkbox" id="deger" value="3"  tabindex="20"/> Cat 3     
  <input name="deger[]" type="checkbox" id="deger" value="4"  tabindex="20"/> Cat 4
  <input name="deger[]" type="checkbox" id="deger" value="5"  tabindex="20"/> Cat 5
  <input name="deger[]" type="checkbox" id="deger" value="6"  tabindex="20"/> Cat 6
  <input name="deger[]" type="checkbox" id="deger" value="7"  tabindex="20"/> Cat 7
  <input name="deger[]" type="checkbox" id="deger" value="8"  tabindex="20"/> Cat 8
  <br/><br/>
 </fieldset>

   <p><input type="submit" name="gonder" value="Gönder" /></p>
       </form>

这是我的bot.php代码


// Wordpress code..
   $my_post = array( 
    'post_title' => $trbaslik, 
    'post_date' => date('Y-m-d H:i:s'), 
    'post_content' => 'Yazı içeriği', 
    'post_status' => 'publish', 
    'post_author' => 1, 
    'post_category' => category id, 
    'meta_input' => array( 'film_yonetmen' => strip_tags($yonetmen[0]) , 'film_basrol' => strip_tags($basrol[0]), 'film_yil' => strip_tags($cikti), 'film_butce' => strip_tags($butce[2]), 'film_kazanci' => strip_tags($kazanc[0]) , 'film_ab_isim' => strip_tags($nick[0]) , 'film_fragman' => strip_tags($fragman[0]) , 'imdb_puan' => strip_tags($imdb[3]) , 'film_yildiz' => strip_tags($sitepuan) )     
); 

wp_insert_post( $my_post ); 

0 个答案:

没有答案