• If I select no category for my Custom post type (but for WP still remains “Uncategorized”), I get
    Notice: Undefined offset: 0 in …\wp-content\plugins\breadcrumbs\yoast-breadcrumbs.php on line 230

    $cats = get_the_category();
    $cat = $cats[0]; // line 230

    The problem is that WP’s get_the_category() has this at the beginning:

    $categories = get_the_terms( $id, 'category' );
    if ( ! $categories )
    	$categories = array();
    
    // ... more stuff below

    The rest of the code doesn’t modify the array (not the function per se), so it’s bound to return empty if no categs are found. Thus the undefined offset 0.

    http://wordpress.org/extend/plugins/yet-another-related-posts-plugin/

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: Yet Another Related Posts Plugin] Undefined offset 0 for Custom Posts with no category’ is closed to new replies.