fix format_categories for empty term list
Some checks failed
Some checks failed
This commit is contained in:
parent
f76fa57665
commit
3f7f996e10
1 changed files with 4 additions and 2 deletions
|
@ -226,9 +226,11 @@ abstract class Event extends Post {
|
||||||
|
|
||||||
// Add all category terms.
|
// Add all category terms.
|
||||||
$terms = \get_the_terms( $this->wp_object, $this->wp_taxonomy );
|
$terms = \get_the_terms( $this->wp_object, $this->wp_taxonomy );
|
||||||
|
if ( $terms && ! is_wp_error( $terms ) ) {
|
||||||
foreach ( $terms as $term ) {
|
foreach ( $terms as $term ) {
|
||||||
$categories[] = $term->name;
|
$categories[] = $term->name;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( ! empty( $categories ) ) {
|
if ( ! empty( $categories ) ) {
|
||||||
return implode( ' · ', array_unique( $categories ) );
|
return implode( ' · ', array_unique( $categories ) );
|
||||||
|
|
Loading…
Reference in a new issue