Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2014
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. if(isset($_REQUEST['cars'])){ // checking which form is coming from post array
  2.  
  3. $make = $_POST['make']; // getting the field from the form and pass it to a variable
  4. $new_post = array( // collecting the information about the new post
  5.  
  6. 'post_title' => $title,
  7.  
  8. 'post_content' => $description,
  9.  
  10. 'tax_input' => array('types' => array('cars')),
  11.  
  12. 'post_status' => 'pending',
  13.  
  14. 'post_type' => 'vehicles'
  15.  
  16. );
  17.  
  18. $pid = wp_insert_post($new_post); // pass the array data from above to the function that actually save the post
  19. wp_set_object_terms($pid, 'cars', 'types', true); // setting the taxonomy for that specific post
  20.  
  21. add_post_meta($pid, 'car_make', $make, true); // adding the meta information about the post. THIS IS WHAT I WANT TO APPEAR IN ADMIN EDIT MENU
  22.  
  23.  
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement