<p>Found an answer to this here: <a href="https://craftcms.stackexchange.com/a/4132/3890">https://craftcms.stackexchange.com/a/4132/3890</a></p>

<p>The important thing to note is when you're using <code>relatedTo</code> you're not passing a slug, you're passing a whole object. So just <code>.relatedTo('category-name')</code> won't work. </p>

CC BY-SA 3.0
2015-08-25T16:52:42.573Z
2015-08-25T16:52:42.573Z
2017-04-13T12:51:00.160Z
Sebastian Thomas
<p>Maybe I'm going mad here, but I can't figure out how to get all entries which are in a certain category. 
Following the syntax laid out here: <a href="http://buildwithcraft.com/help/entries-related-to-category" rel="nofollow">http://buildwithcraft.com/help/entries-related-to-category</a>
you'd think something like this would work, but I get nothing:<br>
<code>{% for entry in craft.entries.relatedTo('Naming') %}</code>
<br><br>
'Naming' is my category, and I have several case study entries with that category attributed.
I also tried adding more params, like restricting it to just the case study section:<br>
<code>{% for entry in craft.entries.section('ourWork').relatedTo('Naming') %}</code><br><br>
This would be outside the category page or related case study page btw, ie on the homepage. </p>

<entries><categories><relations>
Get all entries attributed with category
# Get all entries attributed with category

(Asked by: username_0 on 2015-08-25)

Maybe I'm going mad here, but I can't figure out how to get all entries which are in a certain category.
Following the syntax laid out here: <http://buildwithcraft.com/help/entries-related-to-category>
you'd think something like this would work, but I get nothing:  
`{% for entry in craft.entries.relatedTo('Naming') %}`
  
  
'Naming' is my category, and I have several case study entries with that category attributed.
I also tried adding more params, like restricting it to just the case study section:  
`{% for entry in craft.entries.section('ourWork').relatedTo('Naming') %}`  
  
This would be outside the category page or related case study page btw, ie on the homepage.

**Tags:** entries, categories, relations

---

## 1 answers

### Answer by username_0 on 2015-08-25. Score: 5

Found an answer to this here: <https://craftcms.stackexchange.com/a/4132/3890>

The important thing to note is when you're using `relatedTo` you're not passing a slug, you're passing a whole object. So just `.relatedTo('category-name')` won't work.


---

