Post to inherit custom category background image from parent
You can use this function to output the parent category ID and then style off of that. <?php function wpse_74737_category_top_parent_id($catid) { while ($catid) { $cat = get_category($catid); $catid = $cat -> category_parent; $catParent = $cat -> cat_ID; } return $catParent; } And then call this in your body class: <?php echo wpse_74737_category_top_parent_id( $cat->term_id ); ?>