Question : Get the Post Categories From Outside the Loop
Answered by : indonesia-people
<?php
$post = get_post();
if ( $post ) {
$categories = get_the_category( $post->ID );
var_dump( $categories );
}
Source : https://developer.wordpress.org/reference/functions/get_the_category/ | Last Update : Wed, 11 May 22