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 *

Siteground Web Hosting

Snippet Info

Tested with Wordpress v. NA
Review Status: Needs Review

How to add category id to WordPress body and post class
4.6 (92%) 5 votes
Please report broken snippets.
Report Broken Snippet
WP Engine