eventsmanager

Assign events tag to events using event submission form

Apr 2nd, 2019
379
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. * This snippet assign event tags with event using custom event submission form -> https://pastebin.com/Nvz4t6ca
  3. *
  4. * 1. create mu-plugins folder under wp-content/mu-plugins/function.php
  5. * 2. edit function.php and Save
  6. */
  7. add_filter('em_event_save','custom_event_save',1,2);
  8. function custom_event_save($result,$EM_Event){
  9.  
  10. if ( !empty( $_REQUEST['event_tags'] ) ){
  11. wp_set_object_terms($EM_Event->post_id, $_REQUEST['event_tags'], EM_TAXONOMY_TAG);
  12. }
  13.  
  14. return $result;
  15. }
RAW Paste Data