From 6dd978407340b219ef2d50a3e6c89c87c5ec6789 Mon Sep 17 00:00:00 2001 From: Brian Miyaji Date: Fri, 17 Mar 2017 18:06:22 +1100 Subject: [PATCH] Fix borrowed players not loading on event edit --- modules/sportspress-lazy-loading.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/modules/sportspress-lazy-loading.php b/modules/sportspress-lazy-loading.php index 38b9d711..fe6fca07 100644 --- a/modules/sportspress-lazy-loading.php +++ b/modules/sportspress-lazy-loading.php @@ -173,7 +173,16 @@ class SportsPress_Lazy_Loading { $posts = sp_get_posts( $post_type, $args ); $post_ids = wp_list_pluck( $posts, 'ID' ); $diff = array_diff( $post_ids, $selected ); + $borrowed = array_diff( $selected, $post_ids ); $selected = array_flip( $selected ); + + if ( sizeof( $borrowed ) ) { + $args = array( 'post__in' => $borrowed ); + $borrowed_posts = sp_get_posts( $post_type, $args ); + if ( is_array( $borrowed_posts ) ) { + $posts += $borrowed_posts; + } + } ?>