Tutorial by Examples

Code $categories = get_the_category(); foreach( $categories as $category ) { echo $category->name . '<br />'; } Output All names of categories of the current page, one on each line.
Code $categories = get_the_category(); foreach( $categories as $category ) { echo $category->term_id . '<br />'; } Output All ids of categories of the current page, one on each line.

Page 1 of 1