WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Retrieve category_id's in the loop (2 posts)

  1. nieuws
    Member
    Posted 6 years ago #

    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.

  2. nieuws
    Member
    Posted 6 years ago #

    Alright, finally found the function. Always happens when you just posted the question.

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

Topic Closed

This topic has been closed to new replies.

About this Topic