Tribe__Events__Main::save_venue_data( int $postID = null, WP_Post $post = null )

Make sure the venue meta gets saved


Parameters

$postID

(int) (Optional) The venue id.

Default value: null

$post

(WP_Post) (Optional) The post object.

Default value: null


Top ↑

Return

(null)


Top ↑

Source

File: src/Tribe/Main.php

		public function save_venue_data( $postID = null, $post = null ) {
			// was a venue submitted from the single venue post editor?
			if ( empty( $_POST['post_ID'] ) || $_POST['post_ID'] != $postID || empty( $_POST['venue'] ) ) {
				return;
			}

			// is the current user allowed to edit this venue?
			if ( ! current_user_can( 'edit_tribe_venue', $postID ) ) {
				return;
			}

			$data = stripslashes_deep( $_POST['venue'] );
			/**
			 * When a new venue is saved set the value for ShowMap and ShowMapLink if they are not present as if
			 * a checkbox is set to false $_POST is not going to send the value and is not going to be present inside
			 * of the array. This action is fired on update or creation from the admin so it's not goint to affect
			 * external components like Community Plugin.
			 */
			$data = wp_parse_args( (array) $data, array(
				'ShowMap' => 'false',
				'ShowMapLink' => 'false',
			) );
			Tribe__Events__API::updateVenue( $postID, $data );
		}