| @@ -43,9 +43,11 @@ | ||
| 43 | 43 | $ancestors = []; |
| 44 | 44 | |
| 45 | 45 | if ( is_single() && ! empty( $_current_queried_object_id ) ) { |
| 46 | 46 | $_category_ids = wp_get_post_terms( get_the_ID(), 'doc_category', [ 'fields' => 'ids' ] ); |
| 47 | - $ancestors = get_ancestors( $_category_ids[0], 'doc_category' ); | |
| 47 | + if ( ! is_wp_error( $_category_ids ) && ! empty( $_category_ids ) ) { | |
| 48 | + $ancestors = get_ancestors( $_category_ids[0], 'doc_category' ); | |
| 49 | + } | |
| 48 | 50 | } |
| 49 | 51 | |
| 50 | 52 | if ( ! is_wp_error( $terms ) ) { |
| 51 | 53 | do_action_ref_array( 'betterdocs_layout_base_loop_start', [ & $terms, &$_defined_vars ] ); |