Created
November 4, 2014 07:38
-
-
Save ooooak/1f471542ee3571284281 to your computer and use it in GitHub Desktop.
wordpress change post status to draft
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$posts = get_posts(array( | |
'post_type' => $post_type, | |
'posts_per_page' => -1, | |
'post_status' => 'publish' | |
)); | |
foreach ($posts as $post){ | |
$post->post_status = 'draft'; | |
echo wp_update_post($post); | |
echo '<br/>'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment