Skip to content

(New) venue lost if save_post is triggered twice #202

@stephenharris

Description

@stephenharris

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions