write_post

Calls wp_write_post() and handles the errors.

Description

(int|null) write_post(); 

Returns (int|null)


Usage

  1. if ( !function_exists( 'write_post' ) ) { 
  2. require_once ABSPATH . '/wp-admin/includes/post.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = write_post(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/wp-admin/includes/post.php  
  1. function write_post() { 
  2. $result = wp_write_post(); 
  3. if ( is_wp_error( $result ) ) 
  4. wp_die( $result->get_error_message() ); 
  5. else 
  6. return $result;