
To get all the category id’s from current wordpress blog you have to use following function which returns an array of all the category id’s
1
|
<?php $all_category_ids =get_all_category_ids() ?> |
after that you can fetch to retrieve all the category ids. even you can get category name for each category.
1
2
3
4
5
6
7
|
<?php $category_ids = get_all_category_ids(); foreach ( $category_ids as $cat_id ) { $cat_name = get_cat_name( $cat_id ); echo $cat_id . ': ' . $cat_name . '<br />' ; } ?> |
Leave a Reply