write_post()

Calls wp_write_post() and handles the errors.

Return

(int|void) Post ID on success, void on failure.

Source

File: wp-admin/includes/post.php

function write_post() {
	$result = wp_write_post();
	if ( is_wp_error( $result ) ) {
		wp_die( $result->get_error_message() );
	} else {
		return $result;
	}
}

Changelog

Version Description
2.0.0 Introduced.

© 2003–2021 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/write_post