From f4a3c4397a1fda5e4fbe210019a07618d46cb28f Mon Sep 17 00:00:00 2001 From: Stefan Bohacek Date: Tue, 13 Apr 2021 17:07:38 -0400 Subject: [PATCH] List newly submitted bots first in the admin. --- functions.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/functions.php b/functions.php index 03a38d7..eb4a141 100644 --- a/functions.php +++ b/functions.php @@ -684,3 +684,11 @@ function bw_add_robotstxt( $robots ){ } add_action( 'do_robotstxt', 'bw_add_robotstxt', PHP_INT_MAX ); + +function bw_admin_reorder_posts( $query ){ + if ( is_admin() && $query->is_main_query() && $_GET['post_type'] === 'bot' ) { + $query->set( 'order', 'DESC' ); + } +} + +add_action( 'pre_get_posts', 'bw_admin_reorder_posts' );