write_post()
Calls wp_write_post() and handles the errors.
No Hooks.
Return
Int|null
. Post ID on success, void on failure.
Usage
write_post();
Changelog
Since 2.0.0 | Introduced. |
write_post() write post code WP 6.7.1
function write_post() { $result = wp_write_post(); if ( is_wp_error( $result ) ) { wp_die( $result->get_error_message() ); } else { return $result; } }