I've inherited a theme from a another developer that I've re-styled for a client. We're just about finished, but I thought I'd run it through the Theme-Check plug-in to see if there's any errors or problems.

Unfortunately there's a ton. I've gotten rid of most of them, but I have one Required left:

REQUIRED: Could not find post_class. See: post_class

I've read the WP page on post_class, but as a relative newcomer I still don't understand what it is, or why it should be required.

What should I do to fix this?

  • If the Theme isn't intended for public distribution, then many of the required components of Theme Check will not apply. The post_class() requirement is one of them. Mar 21, 2013 at 17:18
  • @ChipBennett Thanks, Chip. I'll bear that in mind. Probably good practice if the client adds plug-ins themselves in the future, though :) Mar 21, 2013 at 18:04

1 Answer 1


What it does

post_class adds classes to the posts on a post by post basis, usually adding them to some kind of post "wrapper". This allows for the targeting of posts with CSS rules according to various criteria-- category, tag, sticky, format, etc. That is, theme authors, plugin authors, and individual users can write CSS rules based on the classes added by post_class and get very fine grained control over layout.

Why you want it

While I am not a canonical source, I am sure it is required according to the WordPress Theme guidelines to ensure a minimal functionality across themes. If you aren't submitting your theme to the WordPress repo you can do what you want. There are no WordPress Theme Police to track you down and spank you, but post_class and the related body_class are very useful and easy to implement. I see no reason not to use them.

  • Thanks very much! That helps a lot. In my case, though, there's no different styles for different posts, so I suppose it's not very much use to me? Mar 21, 2013 at 14:22
  • There may be no styling for posts right now, but you don't know about later, and you don't know what a plugin might try to do. It is reasonable for a plugin to depend upon officially required functionality.
    – s_ha_dum
    Mar 21, 2013 at 14:43
  • Yes, you're right. I'm going to add it. Mar 21, 2013 at 14:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.