This is an old version of this answer!
Return to the current answerHi, according to the documentation:
With this in mind the code is very simple:
After this your_category will contain the ID of the category in the slug of the current post.
When you assign multiple categories to a post, only one can show up in the permalink. This will be the lowest numbered category
With this in mind the code is very simple:
$categories = wp_get_post_categories(get_the_ID());
$your_category = $categories[0];
After this your_category will contain the ID of the category in the slug of the current post.
Max | 01/05/10 at 6:04pm





