Prevent error on team page when there are no competitions or seasons.
This commit is contained in:
@@ -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',
|
||||||
|
|||||||
Reference in New Issue
Block a user