Tribe__Events__Aggregator__Record__Unsupported::__construct( int|WP_Post|null $post = null )

Tribe__Events__Aggregator__Record__Unsupported constructor.

Overrides the base method to play along nicely for the request context that builds this post and then remove it, if clean is allowed, on shutdown.


Parameters

$post

(int|WP_Post|null) (Optional) The record post or post ID.

Default value: null


Top ↑

Source

File: src/Tribe/Aggregator/Record/Unsupported.php

	public function __construct( $post = null ) {
		parent::__construct( $post );

		/**
		 * Whether unsupported origin records should be removed or not.
		 *
		 * If set to `true` then the post will be deleted on shutdown.
		 *
		 * @since 4.6.25
		 *
		 * @param bool $should_delete Whether the unsupported post should be deleted or not; defaults
		 *                            to `true`.
		 * @param self $this          This record object.
		 * @param WP_Post This record post object.
		 */
		$should_delete = apply_filters( 'tribe_aggregator_clean_unsupported', true, $this, $post );

		if ( $should_delete ) {
			/*
			 * Let's delay the deletion to avoid client code from relying on
			 * a deleted post for this request.
			 */
			add_action( 'shutdown', array( $this, 'delete_post' ) );
		}
	}