Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions php/datasource/class-fieldmanager-datasource-term.php
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,11 @@ protected function build_hierarchical_term_data( $parent_terms, $tax_args, $dept
$prefix .= '--';
}

// This is to avoid PHP warnings when the term is not a term object.
if ( ! $term instanceof \WP_Term || ! $term->term_taxonomy_id || ! $term->term_id || ! $term->name ) {
continue;
}

$key = $this->store_term_taxonomy_id ? $term->term_taxonomy_id : $term->term_id;
$stack[ $key ] = $prefix . ' ' . $term->name;

Expand Down