• Hope somebody can help me solve this, I am struggling for more than 2 days. I have a custom post publishing page and I want to select categories for the post from categories dropdown, and use the value selected. I don’t know what im doing wrong but cant get it to work. It allways publishes the post with uncategorised. Here is the code.

    // Category exists?
    if (!empty($_POST['video_category'])) {
    $video_category = $_POST['video_category'];
    } else {
    $video_category = 'Please select a category';
    }
    
    $my_post['post_category'] = array(prep($row['video_category'])); 
    
    <select name="video_category" class="widefat mid">
     <option value="video_category">Select Category...</option>
     <?php
      $categories=  get_categories('');
      foreach ($categories as $videocategory) {
      	$video_category = '<option value="/category/archives/'.$videocategory->category_nicename.'">';
    	$video_category .= $videocategory->cat_name;
    	$video_category .= selected($videocategory, $_POST['video_category']);
    	$video_category .= '</option>';
    	print ucfirst($video_category);
      }
     ?>
    </select>
  • The topic ‘Post publishing category select ( custom made page )’ is closed to new replies.