Advertisement
eventsmanager

Assign events category to events using event submission form

May 10th, 2024
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. <?php
  2.  
  3. /*
  4. * This snippet assign event tags with event using custom event submission form -> https://pastebin.com/Nvz4t6ca
  5. *
  6. * 1. create mu-plugins folder under wp-content/mu-plugins/function.php
  7. * 2. edit function.php and Save
  8. */
  9. add_filter('em_event_save','custom_event_save',1,2);
  10. function custom_event_save($result,$EM_Event){
  11.  
  12. wp_set_object_terms($EM_Event->post_id, X, EM_TAXONOMY_CATEGORY); // replace X with your events category ID
  13.  
  14. return $result;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement