Advertisement
eventsmanager

[Add Event] Save location URL field

Mar 5th, 2023
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. <?php
  2.  
  3. add_filter('em_location_output_placeholder','my_em_location_custom_url',100,3);
  4. function my_em_location_custom_url($replacement, $EM_Location, $result){
  5. switch( $result ){
  6. case '#_LOCATIONCUSTOMURL':
  7. $replacement = get_post_meta($EM_Location->post_id,'_event_location_url',true);
  8. break;
  9. }
  10. return $replacement;
  11. }
  12.  
  13. function em_locate_get_save_url($EM_Location){
  14. $EM_Location->location_url = get_post_meta($EM_Location->post_id,'_event_location_url',true);
  15. return $EM_Location;
  16. }
  17. add_filter('em_get_location','em_locate_get_save_url',100,2);
  18.  
  19. function em_locate_save_url($result, $EM_Location){
  20. update_post_meta( $EM_Location->post_id, '_event_location_url', $_REQUEST["location_url"]);
  21. return $result;
  22. }
  23. add_filter('em_location_save','em_locate_save_url',100,2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement