Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/get body class

Retrieves the classes for the body element as an array.


<?php get_body_class($class); ?>


(string or array) (optional) A string or array of classes to add to the return value
Default: false

Return Value

An array of class names.

Change Log

  • Since: 2.8.0
  • 3.1.0 Added support for ID style classes

Source File

get_body_class() is located in wp-includes/post-template.php.

See also index of Function Reference and index of Template Tags.