Skip to main content
including my final answer
Source Link
amespower
  • 418
  • 5
  • 17

I am looking for a way to change the post status of some posts based on custom field value, from published to pending for example. How might this be possible?

My solution:

$post_ids = array( 1235, 1234, 1228, 1221, 1211, 1212, 1208, 1200 );

foreach($post_ids as $post_id) {
    $post = array( 'ID' => $post_id, 'post_status' => 'pending' );
    wp_update_post($post);
}

I am looking for a way to change the post status of some posts based on custom field value, from published to pending for example. How might this be possible?

I am looking for a way to change the post status of some posts based on custom field value, from published to pending for example. How might this be possible?

My solution:

$post_ids = array( 1235, 1234, 1228, 1221, 1211, 1212, 1208, 1200 );

foreach($post_ids as $post_id) {
    $post = array( 'ID' => $post_id, 'post_status' => 'pending' );
    wp_update_post($post);
}
Source Link
amespower
  • 418
  • 5
  • 17

Function/filter or plugin to change post status based on custom field value

I am looking for a way to change the post status of some posts based on custom field value, from published to pending for example. How might this be possible?