Title: Loop through categories
Last modified: August 22, 2016

---

# Loop through categories

 *  [Dave Wright](https://wordpress.org/support/users/davetwizzlebird/)
 * (@davetwizzlebird)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/loop-through-categories/)
 * I’d like to create some category based navigation on my site using some custom
   fields I’ve added to my categories. If I was doing this with posts or custom 
   types I’d do this…
 *     ```
       <?php $recentPosts = new WP_Query(); $recentPosts->query('post_type=category&showposts=5');?>
       <?php while ($recentPosts->have_posts()) : $recentPosts->the_post(); ?>
       <?php the_title();?>
       // Custom field stuff here
       <?php endwhile; ?>
       ```
   
 * Obviously I don’t have that luxury with categories, also wp_list_categories is
   a bit flimsy for my needs of hooking into custom field info. Is there any way
   of using categories as you would posts in a standard wp loop?

The topic ‘Loop through categories’ is closed to new replies.

## Tags

 * [categories](https://wordpress.org/support/topic-tag/categories/)
 * [custom fields](https://wordpress.org/support/topic-tag/custom-fields/)
 * [loop](https://wordpress.org/support/topic-tag/loop/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [Dave Wright](https://wordpress.org/support/users/davetwizzlebird/)
 * Last activity: [11 years, 2 months ago](https://wordpress.org/support/topic/loop-through-categories/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
