Support » Developing with WordPress » Retrieve category_id’s in the loop

  • Resolved nieuws

    (@nieuws)


    Hi Everyone,

    I am looking for the right function to retrieve all category_id’s of a certain post within the loop.

    I want to store the id’s in either a variable or an array.

    Thanks in advance.

Viewing 1 replies (of 1 total)
  • Alright, finally found the function. Always happens when you just posted the question.

    <?php foreach((get_the_category()) as $cat)
    {
    echo $cat->cat_ID;
    }
    ?>

Viewing 1 replies (of 1 total)
  • The topic ‘Retrieve category_id’s in the loop’ is closed to new replies.