Autogenerated_Series::remove_autogenerated_flag( WP_Post $series )

Removes the auto-generated flag from a Series post if meaningful edits happened to it.


Parameters

$series

(WP_Post) (Required) A reference to the Series post object.


Top ↑

Return

(bool) Either true if the autogenerated flag was removed, false otherwise.


Top ↑

Source

File: src/Events_Pro/Custom_Tables/V1/Series/Autogenerated_Series.php

	public function remove_autogenerated_flag( WP_Post $series ) {
		$post = $this->check_autogenerated( $series );

		if ( ! $post instanceof WP_Post ) {
			return false;
		}

		// If the checksum is the same, do not remove.
		$remove = ! $this->checksum_matches( $series );

		/**
		 * Filters whether a Series post autogenerated flag should be removed from its
		 * meta or not.
		 *
		 * @since 6.0.0
		 *
		 * @param bool    $remove Whether the autogenerated flag should be removed or not.
		 * @param WP_Post $series A reference to the Series post object the filter is
		 *                        being applied for.
		 */
		$remove = apply_filters( 'tec_events_custom_tables_v1_remove_series_autogenerated_flag', $remove, $series );

		if ( ! $remove ) {
			return false;
		}

		return delete_post_meta( $post->ID, self::FLAG_META_KEY )
		       && delete_post_meta( $post->ID, self::CHECKSUM_META_KEY );
	}

Top ↑

Changelog

Changelog
Version Description
6.0.0 Introduced.