• Hi,

    When accesing to the main page or an unexistent one of an old unmaintained glossary plugin, I catch this warning:

    PHP message: PHP Warning: Undefined property: WP_Post_Type::$term_id in wp-content/themes/write-blog/assets/lib/breadcrumbs/breadcrumbs.php on line 222

    Implied code is:

    $category = get_queried_object();
    $link_item = get_category_link( $category->term_id );

    I solved it with this workaround:

    $category = get_queried_object();
    if ( isset ( $category->term_id ) ) {
    	$link_item = get_category_link( $category->term_id );
    }
    else{
    	$link_item = home_url();
    }

    I suggest you to add this code or any other you consider better to avoid the warning.

    Thanks for your attention.

    • This topic was modified 2 years, 1 month ago by ABCdatos.
  • The topic ‘Warning on breadcrumbs’ is closed to new replies.