Support » Plugin: Yet Another Related Posts Plugin (YARPP) » [Plugin: Yet Another Related Posts Plugin] Undefined offset 0 for Custom Posts with no category
5 years, 4 months ago
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; // 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.
Wait… is this an issue with YARPP? I don’t think you’re describing a YARPP issue…
Damn it. Sorry. It’s not. I was confused by all the Y* plugins. Closing.