• Hi.

    I am working on a plugin that is using wp_query. The basic loop is

    $the_query = new WP_Query($args);
            foreach ($the_query->posts as $cp) {
    }

    I can get almost everything I need, but I am really struggling to return category names for the current post! I can get an array of the id’s
    $cp->post_category

    But I can find nothing that makes sense to me or that works to pull the category names from that – and ideally display them as hyperlinks.

    Can anyone help – I am sure this is really easy!!!

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Looping through post_category and getting category names’ is closed to new replies.