Prevent error on team page when there are no competitions or seasons.

This commit is contained in:
Brian Miyaji
2016-01-02 23:45:47 +11:00
parent ffcf6ef3b2
commit 9e795f1c8e

View File

@@ -421,12 +421,9 @@ class SP_Team extends SP_Custom_Post {
*/ */
public function tables( $admin = false ) { public function tables( $admin = false ) {
if ( ! $this->ID ) return null; if ( ! $this->ID ) return null;
$leagues = get_the_terms( $this->ID, 'sp_league' ); $league_ids = sp_get_the_term_ids( $this->ID, 'sp_league' );
$league_ids = wp_list_pluck( $leagues, 'term_id' ); $season_ids = sp_get_the_term_ids( $this->ID, 'sp_season' );
$seasons = get_the_terms( $this->ID, 'sp_season' );
$season_ids = wp_list_pluck( $seasons, 'term_id' );
$args = array( $args = array(
'post_type' => 'sp_table', 'post_type' => 'sp_table',