Advertisement
Guest User

Simple Front End Post date fix

a guest
Nov 6th, 2013
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.62 KB | None | 0 0
  1. if ( empty( $post_id ) ) {
  2.            
  3.     // this is a new post
  4.            
  5.     $post_data = array(
  6.     'post_author'  => $this->post_author,
  7.     'post_content' => $content,
  8.     'post_type'    => $this->post_type,
  9.     'post_status'  => $this->post_status,
  10.     'post_title'   => $title
  11.     );
  12.            
  13.     $post_id = wp_insert_post($post_data);
  14.            
  15. } else {
  16.            
  17.     // edit post
  18.            
  19.     $post_data = array(
  20.     'ID'        => $post_id,
  21.     'post_author'   => $this->post_author,
  22.     'post_content'  => $content,
  23.     'post_type'     => $this->post_type,
  24.     'post_status'   => $this->post_status,
  25.     'post_title'    => $title
  26.     );
  27.            
  28.     $post_id = wp_update_post($post_data);
  29.            
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement