How to add a class to meta box

When adding a metabox, i.e.:

add_meta_box( 
    'metabox_id',
    'Metabox Title',
    'my_metabox_callback',
    'page',
    'normal',
    'low', 
    array( 'foo' => $var1, 'bar' => $var2)
);

how do I add a class to it for css styling? I’d like to avoid having to call each id in the style rule for metaboxes that contain elements having the same style.

2 s
2

Just add the class to the markup you are generating in the callback.

Leave a Comment