Get list of all categories including their post count in WordPress

<div class="categories-list">
	<?php $categories = get_categories(); ?>
		<?php foreach($categories as $category) { ?>
		<li><a href="<?php echo get_category_link($category->term_id); ?>"><?php echo $category->name; ?> (<?php echo $category->count; ?>)</a></li>
		<?php } ?>
Need a helping hand in fixing your website issues?

If you are facing any problems in implementing these code snippets and tutorials, you can hire us to fix your website issues.

Hire Us