From 9d51824ac2d6f1223c01ac7583b0ea2997880132 Mon Sep 17 00:00:00 2001
From: Erick Hitter <git-contrib@ethitter.com>
Date: Thu, 14 Sep 2017 19:00:35 -0700
Subject: [PATCH] Keep the notice keys out of pagination and such

---
 includes/trait-bulk-actions.php | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/includes/trait-bulk-actions.php b/includes/trait-bulk-actions.php
index f262c55..74fd489 100644
--- a/includes/trait-bulk-actions.php
+++ b/includes/trait-bulk-actions.php
@@ -18,11 +18,25 @@ trait Bulk_Actions {
 		add_action( 'admin_notices', array( __CLASS__, 'admin_notices' ) );
 		add_filter( 'posts_where', array( __CLASS__, 'hide_posts' ), 999, 2 );
 
+		add_filter( 'removable_query_args', array( __CLASS__, 'remove_notice_arg' ) );
+
 		self::register_extra_hooks();
 	}
 
 	/**
-	 *
+	 * Some methods may need extra hooks
 	 */
 	public static function register_extra_hooks() {}
+
+	/**
+	 * Strip the custom notice key, otherwise it turns up in pagination and other unwanted places.
+	 *
+	 * @param array $args Array of one-time query args
+	 * @return array
+	 */
+	public static function remove_notice_arg( $args ) {
+		$args[] = self::ADMIN_NOTICE_KEY;
+
+		return $args;
+	}
 }
-- 
GitLab