diff --git a/includes/class-delete-all.php b/includes/class-delete-all.php index 5eb4ace791590c043140e9e3c23f99024c0801ab..149e17f31ea4e497d76db594f5fb64cf5ac8340c 100644 --- a/includes/class-delete-all.php +++ b/includes/class-delete-all.php @@ -141,14 +141,6 @@ class Delete_All { * @return string */ public static function hide_posts( $where, $q ) { - if ( ! is_admin() || ! $q->is_main_query() ) { - return $where; - } - - if ( 'edit' !== get_current_screen()->base ) { - return $where; - } - if ( 'trash' !== $q->get( 'post_status' ) ) { return $where; } diff --git a/includes/class-delete-permanently.php b/includes/class-delete-permanently.php index 5d989b4bb794aee625dc54f288c07a145e6eacbf..e9687589369137339c028125d6436adf1cb8ae7d 100644 --- a/includes/class-delete-permanently.php +++ b/includes/class-delete-permanently.php @@ -125,14 +125,6 @@ class Delete_Permanently { * @return string */ public static function hide_posts( $where, $q ) { - if ( ! is_admin() || ! $q->is_main_query() ) { - return $where; - } - - if ( 'edit' !== get_current_screen()->base ) { - return $where; - } - if ( 'trash' !== $q->get( 'post_status' ) ) { return $where; } diff --git a/includes/class-edit.php b/includes/class-edit.php index 2e7ce48a9a558027be02f97ee337c4e0208b45c1..b39f7539276a4c2d37c34a94961deced1142bea2 100644 --- a/includes/class-edit.php +++ b/includes/class-edit.php @@ -133,14 +133,6 @@ class Edit { * @return string */ public static function hide_posts( $where, $q ) { - if ( ! is_admin() || ! $q->is_main_query() ) { - return $where; - } - - if ( 'edit' !== get_current_screen()->base ) { - return $where; - } - if ( 'trash' === $q->get( 'post_status' ) ) { return $where; } diff --git a/includes/class-move-to-trash.php b/includes/class-move-to-trash.php index 51d60b165babd8b595ffd0dd93b465a198f3b713..379dd25ebfab945971f326b5049bff798bef984c 100644 --- a/includes/class-move-to-trash.php +++ b/includes/class-move-to-trash.php @@ -132,14 +132,6 @@ class Move_To_Trash { * @return string */ public static function hide_posts( $where, $q ) { - if ( ! is_admin() || ! $q->is_main_query() ) { - return $where; - } - - if ( 'edit' !== get_current_screen()->base ) { - return $where; - } - if ( 'trash' === $q->get( 'post_status' ) ) { return $where; } diff --git a/includes/class-restore-from-trash.php b/includes/class-restore-from-trash.php index 2b982bef2e7028cbaf6ccd6a38a38c3becf06fbc..b36c6a56e3d64f7c3a82e0b429106c7c3f948188 100644 --- a/includes/class-restore-from-trash.php +++ b/includes/class-restore-from-trash.php @@ -125,14 +125,6 @@ class Restore_From_Trash { * @return string */ public static function hide_posts( $where, $q ) { - if ( ! is_admin() || ! $q->is_main_query() ) { - return $where; - } - - if ( 'edit' !== get_current_screen()->base ) { - return $where; - } - if ( 'trash' !== $q->get( 'post_status' ) ) { return $where; } diff --git a/includes/trait-bulk-actions.php b/includes/trait-bulk-actions.php index 74fd489e9923484054ab6220f0407abf8d7fc86c..4c90149f0b4f91f47fddf871c50acef096fd9790 100644 --- a/includes/trait-bulk-actions.php +++ b/includes/trait-bulk-actions.php @@ -28,10 +28,29 @@ trait Bulk_Actions { */ public static function register_extra_hooks() {} + /** + * When an edit is pending for a given post type, hide those posts in the admin + * + * @param string $where Posts' WHERE clause. + * @param object $q WP_Query object. + * @return string + */ + public static function hide_posts( $where, $q ) { + if ( ! is_admin() || ! $q->is_main_query() ) { + return $where; + } + + if ( 'edit' !== get_current_screen()->base ) { + return $where; + } + + return parent::hide_posts( $where, $q ); + } + /** * Strip the custom notice key, otherwise it turns up in pagination and other unwanted places. * - * @param array $args Array of one-time query args + * @param array $args Array of one-time query args. * @return array */ public static function remove_notice_arg( $args ) {