Related posts loop based on tags AND categories doesn’t work without at least one tag assigned
You haven’t accounted for the case that there are no tags assigned in your declaration of $tag_related_posts. Your get_posts function always returns results in your line of code: $tag_related_posts = get_posts(‘exclude=” . $post->ID . “&numberposts=” . $max_articles . “&tag=’ . $tags_string); If the $tags_string is null, it just returns a random list of posts and … Read more