Skip to content

Instantly share code, notes, and snippets.

@RiFi2k
Created April 10, 2017 02:23
Show Gist options
  • Save RiFi2k/ef9eb08df23a3fcc60cc28d6134a233b to your computer and use it in GitHub Desktop.
Save RiFi2k/ef9eb08df23a3fcc60cc28d6134a233b to your computer and use it in GitHub Desktop.
<?php update_post_meta( $post_id, $meta_key, $meta_value, $prev_value ); ?>
//add attendee to event ateendee list (relationship)
$event_id = $_POST['post_id'];
$attendee_list = get_field( 'attendees_list', $event_id );
$new_attendee = get_post( $attendee_id );
if( !is_array($attendee_list) ):
$attendee_list = array();
endif;
array_push( $attendee_list, $new_attendee );
update_field( 'field_54811a48219fd', $attendee_list, $event_id );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment