3 posts from each existing category on one page

I found a problem. I had to change this:

$args = array(
    'cat' => $category->name,
    'posts_per_page' => 3,);

for this:

$args = array(
    'category_name' => $category->name,
    'posts_per_page' => 3,);

In first code I was passing category name which is string to argument expecting ID of category. Here is Codex reference where I found solution:

  • category_name (string) – use category slug.
  • category__and (array) – use category id.
  • category__in (array) – use category id.
  • category__not_in (array) – use category id.

deneme bonusu veren sitelerbahis casinomakrobetceltabetpinbahispolobetpolobet girişpinbahis girişmakrobet girişpulibet girişmobilbahis girişkolaybet giriş