ActionScheduler_wpPostStore::get_action_status_by_post_status()protectedWC 1.0

Get action status by post status.

Method of the class: ActionScheduler_wpPostStore{}

No Hooks.

Return

String.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_action_status_by_post_status( $post_status );
$post_status(string) (required)
Post status.

ActionScheduler_wpPostStore::get_action_status_by_post_status() code WC 8.7.0

protected function get_action_status_by_post_status( $post_status ) {

	switch ( $post_status ) {
		case 'publish':
			$action_status = self::STATUS_COMPLETE;
			break;
		case 'trash':
			$action_status = self::STATUS_CANCELED;
			break;
		default:
			if ( ! array_key_exists( $post_status, $this->get_status_labels() ) ) {
				throw new InvalidArgumentException( sprintf( 'Invalid post status: "%s". No matching action status available.', $post_status ) );
			}
			$action_status = $post_status;
			break;
	}

	return $action_status;
}