Recipe_Post_Utilities::change_default_post_status( $post_ID,  $post,  $update )


Parameters Parameters

$post_ID

(Required)

$post

(Required)

$update

(Required)


Source Source

File: src/core/automator-post-types/uo-recipe/class-recipe-post-utilities.php

	public function change_default_post_status( $post_ID, $post, $update ) {

		if ( 'uo-recipe' !== (string) $post->post_type ) {
			return;
		}
		if ( 'auto-draft' !== (string) $post->post_status ) {
			return;
		}

		// Update post
		$args = array(
			'ID'          => $post_ID,
			'post_status' => 'draft',
			'post_title'  => '',
		);

		// Update the post into the database
		wp_update_post( $args );

		//Save "user" recipe type as the default IF pro is not active
		if ( ! defined( 'AUTOMATOR_PRO_FILE' ) ) {
			update_post_meta( $post_ID, 'uap_recipe_type', 'user' );
		}

		// Save automator version for future use in case
		// something has to be changed for older recipes
		update_post_meta( $post_ID, 'uap_recipe_version', Utilities::automator_get_version() );
		update_post_meta( $post_ID, 'recipe_completions_allowed', '-1' );
		update_post_meta( $post_ID, 'recipe_max_completions_allowed', '-1' );
	}