You might be able to do this via a custom script to get all posts then update the sp_columns
post meta. Here’s some temporary code you could add to your theme’s functions.php to make this happen:
function my_custom_sportspress_player_columns() {
$columns = array( 'team', 'goals', 'assists', 'yellowcards', 'redcards' ); // Add the variable names (slugs) to this array
$args = array(
'post_type' => 'sp_player',
'posts_per_page' => -1,
'fields' => 'ids'
);
$players = get_posts( $args );
if ( ! is_array( $players ) ) return;
foreach ( $players as $player ) {
update_post_meta( $player, 'sp_columns', $columns );
}
}
add_action( 'admin_init', 'my_custom_sportspress_player_columns' );
Edit the 2nd line to include the variable names (slugs) of the columns you want to turn on for all players, for example:
$columns = array( 'team', 'g', 'a', 'pim', 'p', 'gp' );
You can verify the slugs by going to SportsPress > Configure.
Once you’ve added this code to the bottom of your active theme’s functions.php, load the admin page once. The script will run each time you load the admin, so be careful ??
After the admin loads, delete the code. The changes should be applied to every player now. Depending on the number of players, there is a chance that this could time out. If this happens, we’ll need to tweak the code.
Let me know if that works! This would probably be much easier as a global setting, so I’ve added it to our roadmap for the next major update ??