Fix error in event results if team was deleted
This commit is contained in:
@@ -16,6 +16,10 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
* General functions
|
||||
*/
|
||||
|
||||
function sp_post_exists( $post = 0 ) {
|
||||
return is_string( get_post_status( $post ) );
|
||||
}
|
||||
|
||||
function sp_get_time( $post = 0, $format = null ) {
|
||||
if ( null == $format ) $format = get_option( 'time_format' );
|
||||
return get_post_time( $format, false, $post, true );
|
||||
|
||||
@@ -66,7 +66,7 @@ foreach( $data as $team_id => $result ):
|
||||
|
||||
$team_name = sp_get_team_name( $team_id, $abbreviate_teams );
|
||||
|
||||
if ( $link_teams ):
|
||||
if ( $link_teams && sp_post_exists( $team_id ) ):
|
||||
$team_name = '<a href="' . get_post_permalink( $team_id ) . '">' . $team_name . '</a>';
|
||||
endif;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user