Avoid PHP warning on Calendar edit page
Avoid PHP Warning: Invalid argument supplied for foreach() in \wp-content\plugins\sportspress-pro\includes\sportspress\includes\class-sp-event.php on line 587 The error occurs on Calendar Edit page when there is an event without an assigned official.
This commit is contained in:
@@ -584,9 +584,12 @@ class SP_Event extends SP_Custom_Post{
|
|||||||
if ( ! $include_empty && empty( $duty_appointments ) ) continue;
|
if ( ! $include_empty && empty( $duty_appointments ) ) continue;
|
||||||
|
|
||||||
$appointed_officials = array();
|
$appointed_officials = array();
|
||||||
|
|
||||||
|
if ( is_array( $duty_appointments ) ) {
|
||||||
foreach ( $duty_appointments as $duty_appointment ) {
|
foreach ( $duty_appointments as $duty_appointment ) {
|
||||||
$appointed_officials[ $duty_appointment ] = get_the_title( $duty_appointment );
|
$appointed_officials[ $duty_appointment ] = get_the_title( $duty_appointment );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( $include_empty && empty( $appointed_officials ) ) $appointed_officials[] = $placeholder;
|
if ( $include_empty && empty( $appointed_officials ) ) $appointed_officials[] = $placeholder;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user