function rssmi_delete_posts_admin() { // USE FOR QUICK DELETE OF BLOG POSTS global $wpdb; $expiration = -1; $query = "SELECT ID FROM {$wpdb->posts} WHERE post_status = 'publish' AND post_type = 'post' AND DATEDIFF(NOW(), `post_date`) > " . $expiration; $ids = $wpdb->get_results($query); foreach ($ids as $id) { $mypostids = $wpdb->get_results("SELECT * FROM {$wpdb->postmeta} WHERE meta_key = 'rssmi_source_link' AND post_id = " . $id->ID); if (!empty($mypostids)) { rssmi_delete_attachment($id->ID); wp_delete_post($id->ID, true); } } }
function rssmi_delete_posts_admin_attachment($pid) { trigger_error("Deprecated function called: " . __FUNCTION__, E_USER_NOTICE); $rssmi_source_link = get_post_meta($pid, 'rssmi_source_link', true); if (!empty($rssmi_source_link)) { rssmi_delete_attachment($rssmi_source_link); } }