Guest User

Untitled

a guest
Jun 25th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. function save_book_meta( $post_id, $post, $update ) {
  2.  
  3. $slug = 'book'; //Slug of CPT
  4.  
  5. // If this isn't a 'book' post, don't update it.
  6. if ( $slug != $post->post_type ) {
  7. return;
  8. }
  9.  
  10. wp_set_object_terms( get_the_ID(), $term_id, $taxonomy );
  11. }
  12.  
  13. add_action( 'save_post', 'save_book_meta', 10, 3 );
Add Comment
Please, Sign In to add comment