Skip to content

Instantly share code, notes, and snippets.

@kadimi
Last active October 14, 2022 14:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kadimi/a6104a8790ea8a2e02e71238c724a6f9 to your computer and use it in GitHub Desktop.
Save kadimi/a6104a8790ea8a2e02e71238c724a6f9 to your computer and use it in GitHub Desktop.
Fix SportsPress player stats (offense/defense)
<?php
add_filter( 'sportspress_player_data_event_args', function( $args ) {
foreach ( $args[ 'meta_query' ] as &$m ) {
if ( true
&& is_array( $m )
&& array_key_exists( 'key', $m )
&& in_array($m[ 'key' ], [ 'sp_offense', 'sp_defense' ] )
) {
$m = null;
}
}
return $args;
} );
@reckseidlerdesign
Copy link

Where does this file go?
Can the snippet be added to an existing file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment