Do you want to add the post category to body_class on every single posts page with by using the code of a simple function?
Then you land at the right place.
We have written and embedded a function which will easily add the category to body_class, For that:
You just need to follow below guide.
Add Post Category to body_class on Single Posts
First of all, Just copy the below codes and paste it into your WordPress theme’s functions.php file.
Code for Add Category to body_class
Save the file and view the result in your browser.
Hope it helped you.
Let us know if you have any query in the comment box.
Don’t forget to share this Add Post Category to body_class on post’s page.