From ec87ae4273b14b26dd0dfefb24e8faaa9ac85364 Mon Sep 17 00:00:00 2001 From: Brian Miyaji Date: Thu, 22 May 2014 09:58:19 +1000 Subject: [PATCH] Force delete preset posts when switching sport --- includes/admin/class-sp-admin-sports.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/admin/class-sp-admin-sports.php b/includes/admin/class-sp-admin-sports.php index 96aa78f6..51ef5871 100644 --- a/includes/admin/class-sp-admin-sports.php +++ b/includes/admin/class-sp-admin-sports.php @@ -141,8 +141,8 @@ class SP_Admin_Sports { public static function delete_preset_posts( $post_type = null ) { $args = array( 'post_type' => $post_type, - 'numberposts' => -1, 'posts_per_page' => -1, + 'post_status' => array( 'publish', 'pending', 'draft', 'auto-draft', 'future', 'private', 'inherit', 'trash' ), 'meta_query' => array( array( 'key' => '_sp_preset', @@ -154,7 +154,7 @@ class SP_Admin_Sports { // Delete posts $old_posts = get_posts( $args ); foreach( $old_posts as $post ): - wp_delete_post( $post->ID, true); + wp_delete_post( $post->ID, true ); endforeach; }