Пример #1
0
 public function when_post_trash_delete($post_id)
 {
     global $wpdb;
     $post_id = intval($post_id);
     $ow_history_service = new OW_History_Service();
     $histories = $ow_history_service->get_action_history_by_post($post_id);
     if ($histories) {
         foreach ($histories as $history) {
             $wpdb->get_results($wpdb->prepare("DELETE FROM " . OW_Utility::instance()->get_action_table_name() . " WHERE action_history_id = %d", $history->ID));
             $wpdb->get_results($wpdb->prepare("DELETE FROM " . OW_Utility::instance()->get_emails_table_name() . " WHERE history_id = %d", $history->ID));
         }
         $wpdb->get_results($wpdb->prepare("DELETE FROM " . OW_Utility::instance()->get_action_history_table_name() . " WHERE post_id = %d", $post_id));
     }
     $original_post = get_post_meta($post_id, 'oasis_original', true);
     delete_post_meta($post_id, 'oasis_original');
     $this->cleanup_after_workflow_complete($post_id);
 }