Advertisement
PhoTonFlinger

Untitled

Nov 11th, 2018
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. function buddydev_add_default_category_to_post( $post_id ) {
  2.  
  3. $tax = array_filter( $_POST['tax_input'] );
  4.  
  5. if( empty( $tax ) && $post_id ) {
  6. //no category was set
  7. $term = 79;//ID
  8. wp_set_object_terms( $post_id, $term, 'category' );
  9.  
  10. }
  11.  
  12.  
  13. }
  14.  
  15. function buddyblog_show_custom_cats( $settings ) {
  16. $tax = array();
  17.  
  18. $tax['category'] = array(
  19.  
  20. 'taxonomy' => 'category',
  21. 'view_type' => 'dd',
  22. 'child_of' => 91, //CHAGE It with the correct ID,
  23. 'orderby' => 'slug',
  24. 'order' => 'ASC'
  25. );
  26.  
  27. $settings['tax'] = $tax;
  28.  
  29. return $settings;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement