ActionScheduler_wpPostStore::make_action_from_post()protectedWC 1.0

Make action from post.

Method of the class: ActionScheduler_wpPostStore{}

No Hooks.

Return

WP_Post.

Usage

// protected - for code of main (parent) or child class
$result = $this->make_action_from_post( $post );
$post(WP_Post) (required)
Post object.

ActionScheduler_wpPostStore::make_action_from_post() code WC 9.3.3

protected function make_action_from_post( $post ) {
	$hook = $post->post_title;

	$args = json_decode( $post->post_content, true );
	$this->validate_args( $args, $post->ID );

	$schedule = get_post_meta( $post->ID, self::SCHEDULE_META_KEY, true );
	$this->validate_schedule( $schedule, $post->ID );

	$group = wp_get_object_terms( $post->ID, self::GROUP_TAXONOMY, array( 'fields' => 'names' ) );
	$group = empty( $group ) ? '' : reset( $group );

	return ActionScheduler::factory()->get_stored_action( $this->get_action_status_by_post_status( $post->post_status ), $hook, $args, $schedule, $group );
}