How to add category id to WordPress body and post class

This snippet is very handy if you wish to add the category ID to the body or post class for ex. targeting CSS styles and such.

Instructions
Add this to your functions.php file.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Snippet Info

Tested with Wordpress v. NA
Review Status: Needs Review

How to add category id to WordPress body and post class
4.4 (88.57%) 7 vote[s]
Please report broken snippets.
Report Broken Snippet
WP Engine