If you have the CPT’s ID in the $event_id
variable you plug into the get_post()
call – why would you not simply just (re)use that for the first parameter of get_post_meta()
?
That aside, get_post()
returns a post object (instance of WP_Post), which you choose to assign to $event
. Hence $event
now has a public property $ID
, which can be accessed by $event->ID
.