Webriti Themes Blog

Stay updated with our latest news

How to dispaly list of categories without links in WordPress

priyanshu | Jun 19,2011 |   No Comments

You can use a function get_categories for this

This function Returns an array of category objects matching the query parameters.

Arguments are pretty much the same as wp_list_categories and can be passed as either array or in query syntax.

in short you can use this snippet

foreach((get_categories()) as $category) {
echo “<li>”.$category->name .”</li>”;

note # make sure that atleast one post is present in all of  the categories

Leave a Reply