user2540405
user2540405

Reputation: 1

Which function is used for posting in wordpress

In my Wordpress site users are unable to do any post. They saved in draft but not publish. Please give any suggestions.

https://codex.wordpress.org/Function_Reference/wp_insert_post

I think wp_insert_post() is used for posting. I am new in wordpress please help me.

Upvotes: 0

Views: 48

Answers (2)

Daniel Seichter
Daniel Seichter

Reputation: 909

Please take look into settings - general and check your timezone! It should be something like UTC+0, NOT e.g. Berlin, Zagreb, etc.

I had the same issue after hours of debugging and at least, I changed the timezone to UTC+0 and it worked.

see also: Wordpress admin cannot publish posts

Upvotes: 1

Vikas Gautam
Vikas Gautam

Reputation: 978

$post = array(
  'post_title'    => 'post name',
  'post_content'  => 'This post.',
  'post_status'   => 'publish',
  'post_author'   => 1,
  'post_category' => array('cat id')
);
    wp_insert_post( $post );

Upvotes: 1

Related Questions