WordPress at Your Fingertips
function is not described

ActionScheduler_wpPostStore::save_post_array() protected WC 1.0

Save post array.

{} It's a method of the class: ActionScheduler_wpPostStore{}

No Hooks.

Return

Int. Returns the post ID.

Usage

// protected - for code of main (parent) or child class
$result = $this->save_post_array( $post_array );
$post_array(array) (required)
Post array.

Code of ActionScheduler_wpPostStore::save_post_array() WC 6.1.1

protected function save_post_array( $post_array ) {
	add_filter( 'wp_insert_post_data', array( $this, 'filter_insert_post_data' ), 10, 1 );
	add_filter( 'pre_wp_unique_post_slug', array( $this, 'set_unique_post_slug' ), 10, 5 );

	$has_kses = false !== has_filter( 'content_save_pre', 'wp_filter_post_kses' );

	if ( $has_kses ) {
		// Prevent KSES from corrupting JSON in post_content.
		kses_remove_filters();
	}

	$post_id = wp_insert_post( $post_array );

	if ( $has_kses ) {
		kses_init_filters();
	}

	remove_filter( 'wp_insert_post_data', array( $this, 'filter_insert_post_data' ), 10 );
	remove_filter( 'pre_wp_unique_post_slug', array( $this, 'set_unique_post_slug' ), 10 );

	if ( is_wp_error( $post_id ) || empty( $post_id ) ) {
		throw new RuntimeException( __( 'Unable to save action.', 'woocommerce' ) );
	}
	return $post_id;
}