How to untrash a post only if it was not a draft?
Just as @cybmeta mentioned, the info is stored in the post meta table. When we trash a post then the post meta key _wp_trash_meta_status is added with the value of the previous post status (publish, pending, draft, … ). Within the wp_trash_post() function, we have: add_post_meta($post_id,’_wp_trash_meta_status’, $post[‘post_status’]); add_post_meta($post_id,’_wp_trash_meta_time’, time()); We might therefore try: // Get … Read more