-
Notifications
You must be signed in to change notification settings - Fork 77
Closed
Labels
Description
This was originally reported here: http://wp-event-organiser.com/forums/topic/custom-save-post-interferers-with-venue-saving/#post-11631.
When an event is saved with a new venue, the venue details are $_POSTed, but not ID is given. Event Organiser's callback recognises a venue (but no ID) is given so creates a venue.
However, if that callback is called again on the request (e.g. third party code calls wp_update_post()), since there is still no venue ID it attempts to create the venue (again). This fails because it's a duplicated venue. Consequently the callback sets the venue ID to null, and the venue-event link is lost.
Instead, if when creating a venue a term_exists error is encountered, we should retrieve the existing venue ID.