PHP Notices: property ‘name’ of non-object ‘term_id’ of non-object

I have inherited a problematic website after communication broke-down with their original web developer.

I have been working through and resolving as many errors as possible.

I’m left with a few in the error log including these…

PHP Notice: Trying to get property ‘term_id’ of non-object in /wp-content/themes/modus/inc/admin/functions.php on line 268

PHP Notice: Trying to get property ‘name’ of non-object in /wp-content/themes/modus/inc/admin/functions.php on line 276

I am hopeful that someone here can shine some light on this issue.

Pasting lines 268 onwards below – the last line is line 276

$ancestors = array_reverse( get_ancestors( $current_term->term_id, get_query_var( ‘taxonomy’ ) ) );

foreach ( $ancestors as $ancestor ) {
$ancestor = get_term( $ancestor, get_query_var( ‘taxonomy’ ) );

echo ‘



Source link