WordPress Get all names of categories of the post


Example

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.