Site icon Hip-Hop Website Design and Development

PHP Warning: Try to learn property "term_id" on bool

Since updating from PHP 7.4 to PHP 8, my error_log is now filled with traces like this from a toddler theme I am utilizing:

[17-Oct-2021 13:30:38 UTC] PHP Warning: Try to learn property "term_id" on bool in ./public_html/wp-content/themes/themename-child/capabilities.php on line 181

Right here is the block that’s throwing the error. It was used to change the pagination so posts of a specific kind (hyperlinks) aren’t navigated.

// modify pagination to exclude post_format of 'hyperlink' on information/weblog posts
operate profound_navigation() {
    $earlier = ( is_attachment() ) ? get_post( get_post()->post_parent ) : get_adjacent_post( false, '', true );
    $subsequent     = get_adjacent_post( false, '', false );
    if ( ! $subsequent && ! $earlier ) {
        return;
    }
    $link_term = get_term_by('slug' , 'post-format-link' , 'post_format');
    $quote_term = get_term_by('slug' , 'post-format-quote' , 'post-format');

    the_post_navigation(
            array(
                    'next_text' => '<span class="meta-nav">Subsequent Article <i class="flaticon-right-arrow"></i></span><h3 class="title">%title</h3>',
                    'prev_text' => '<span class="meta-nav"><i class="flaticon-left-arrow-1"></i> Earlier Article</span><h3 class="title">%title</h3>',
                    // 'taxonomy' => 'post_format',
                    'excluded_terms' => array($link_term->term_id, $quote_term->term_id, 156),
            )
    );
}

Looks as if the code nonetheless works advantageous, however how do I modify this code to keep away from filling up my error log?