From 96054d3028f8f9d38687e2f3a26308b8516600fd Mon Sep 17 00:00:00 2001
From: Erick Hitter <git-contrib@ethitter.com>
Date: Tue, 12 Sep 2017 22:05:16 -0700
Subject: [PATCH] Improve reliability of `post_status` capture

---
 includes/class-main.php | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/includes/class-main.php b/includes/class-main.php
index 0134ae8..ec22ea5 100644
--- a/includes/class-main.php
+++ b/includes/class-main.php
@@ -93,8 +93,6 @@ class Main {
 
 		if ( isset( $_REQUEST['delete_all'] ) || isset( $_REQUEST['delete_all2'] ) ) {
 			$vars->action = 'delete_all';
-
-			$vars->post_status = $_REQUEST['post_status'];
 		} elseif ( isset( $_REQUEST['action'] ) && '-1' !== $_REQUEST['action'] ) {
 			$vars->action = $_REQUEST['action'];
 		} elseif ( isset( $_REQUEST['action2'] ) && '-1' !== $_REQUEST['action2'] ) {
@@ -137,6 +135,11 @@ class Main {
 			$vars->post_format = $_REQUEST['post_format'];
 		}
 
+		// Post status is special.
+		if ( is_null( $vars->post_status ) && isset( $_REQUEST['post_status'] ) && ! empty( $_REQUEST['post_status'] ) ) {
+			$vars->post_status = $_REQUEST['post_status'];
+		}
+
 		return $vars;
 	}
 
-- 
GitLab