How to update page status from publish to draft and draft to publish

A faster solution is:

$post = array( 'ID' => $post_id, 'post_status' => $status );
wp_update_post($post);

This way you don’t have to get the post.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)