eventsmanager icon

[Add Event] Save location URL field

eventsmanager | PRO | 03/05/23 11:29:41 AM UTC | 0 ⭐ | 524 👁️ | Never ⏰ | []
text |

790 B

|

None

|

0 👍

/

0 👎

<?php
 add_filter('em_location_output_placeholder','my_em_location_custom_url',100,3);
function my_em_location_custom_url($replacement, $EM_Location, $result){
    switch( $result ){
	case '#_LOCATIONCUSTOMURL':
		$replacement = get_post_meta($EM_Location->post_id,'_event_location_url',true);
		break;
	} 
    return $replacement;
}
 function em_locate_get_save_url($EM_Location){
	$EM_Location->location_url = get_post_meta($EM_Location->post_id,'_event_location_url',true);
	return $EM_Location;
}
add_filter('em_get_location','em_locate_get_save_url',100,2);
 function em_locate_save_url($result, $EM_Location){
	update_post_meta( $EM_Location->post_id, '_event_location_url', $_REQUEST["location_url"]);
	return $result;
}
add_filter('em_location_save','em_locate_save_url',100,2);

Comments