Hy,
I install Antropos plugin and need one change. Author of plugin is not replying to comments on his blog so I need help from someone with more knowledge in php then I have. :)
This function I need to change:
function atropos_delete_expired_posts () {
global $wpdb;
$result = $wpdb->get_results("SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key = '_atropos_expiration_date' AND meta_value < '" . date("Y/m/d") . "'");
foreach ($result as $a) {
wp_delete_post ($a->post_id); //THIS LINE NEED TO CHANGE
}
Change it to just change post status from "publish" to "pending". I do not want to delete those posts.
I was thinking something like this but that isn't working:
function atropos_delete_expired_posts () {
global $wpdb;
$result = $wpdb->get_results("SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key = '_atropos_expiration_date' AND meta_value < '" . date("Y/m/d") . "'");
foreach ($result as $a) {
//I PUT NEXT 4 LINES INSTEAD
$my_post = array();
$my_post['ID'] = $a;
$my_post['post_status'] = 'pending';
wp_update_post( $my_post );
}
I also find on web some other code:
$mysql_query('UPDATE wp_posts SET post_status = "pending", WHERE ID = "'.$a['ID'].'"');
I think my problem is that I don't know how to implement code correctly so, if You have any idea I would be grateful.
Thanks!
Andrija