ActionScheduler_wpPostStore::create_post_array
Create post array.
Method of the class: ActionScheduler_wpPostStore{}
No Hooks.
Returns
Array. Returns an array of post data.
Usage
// protected - for code of main (parent) or child class $result = $this->create_post_array( $action, ?DateTime $scheduled_date );
- $action(ActionScheduler_Action) (required)
- Scheduled Action.
- ?DateTime $scheduled_date
- .
Default:null
ActionScheduler_wpPostStore::create_post_array() ActionScheduler wpPostStore::create post array code WC 10.6.2
protected function create_post_array( ActionScheduler_Action $action, ?DateTime $scheduled_date = null ) {
$post = array(
'post_type' => self::POST_TYPE,
'post_title' => $action->get_hook(),
'post_content' => wp_json_encode( $action->get_args() ),
'post_status' => ( $action->is_finished() ? 'publish' : 'pending' ),
'post_date_gmt' => $this->get_scheduled_date_string( $action, $scheduled_date ),
'post_date' => $this->get_scheduled_date_string_local( $action, $scheduled_date ),
);
return $post;
}