diff --git a/includes/admin/post-types/meta-boxes/class-sp-meta-box-list-details.php b/includes/admin/post-types/meta-boxes/class-sp-meta-box-list-details.php index 4762dfeb..9daea485 100644 --- a/includes/admin/post-types/meta-boxes/class-sp-meta-box-list-details.php +++ b/includes/admin/post-types/meta-boxes/class-sp-meta-box-list-details.php @@ -159,7 +159,16 @@ class SP_Meta_Box_List_Details {

ID, 'sp_player', ( 'auto' == $select ? 'none' : 'block' ), array( 'sp_league', 'sp_season', 'sp_current_team' ) ); + $player_filters = array( 'sp_league', 'sp_season' ); + if ( $team_id ) { + if ( in_array( $era, [ 'all', 'past' ] ) ) { + $player_filters[] = 'sp_past_team'; + } + if ( in_array( $era, [ 'all', 'current' ] ) ) { + $player_filters[] = 'sp_current_team'; + } + } + sp_post_checklist( $post->ID, 'sp_player', ( 'auto' == $select ? 'none' : 'block' ), $player_filters ); sp_post_adder( 'sp_player', __( 'Add New', 'sportspress' ) ); } else { ?> @@ -196,4 +205,4 @@ class SP_Meta_Box_List_Details { sp_update_post_meta_recursive( $post_id, 'sp_player', sp_array_value( $_POST, 'sp_player', array() ) ); sp_update_post_meta_recursive( $post_id, 'sp_nationality', sp_array_value( $_POST, 'sp_nationality', array() ) ); } -} \ No newline at end of file +}