Get Category from Post


right now i am getting the category with this Code:

if (get_the_category( $id )[0]->name == "catname") {


but with this Method i only get ONE Category, even if i change the 0to 1or any other number. I tried the same method with:

if (wp_get_post_categories( $id )[0]->name == "catname") {


but this has the same effect, i can only get one categoryname or ask for one specific.

The Post i am using has 3 categories.

How can i get the other categories? Or how can i ask for the other categories(with if)


>>> Share a link to this question, just copy and paste the code bellow on your web page <<<

<a href="">

Get Category from Post</a>
, , , yama_HD 2 months 0 Answers 70 views 0

Leave an answer