postbox_classes_screen_id_box_id filter

Filters the postbox classes for a specific screen and box ID combo.

apply_filters( "postbox_classes_{$screen_id}_{$box_id}", string[] $classes )

Description

This is filter hook , its filter the postbox classes for a specific screen and box ID combo.
Its consists of one parameter, that is $classes an array of postbox classes.
The dynamic portions of the hook name, $screen_id and $box_id, refer to the screen ID and meta box ID, respectively.
Its used by postbox_classes() which returns the list of classes to be used by a meta box.

Parameters

  • $classes : (string[]) An array of postbox classes.

Live Example

To run the hook, copy the example below.

apply_filters( "postbox_classes_{$screen_id}_{$box_id}", string[] $classes )

The following example is for adding a hook callback.

add_filter('postbox_classes_screen_id_box_id','add_metabox_classes');

function add_metabox_classes($classes) {
    array_push($classes,'another_class');
    return $classes;
}

To remove a hook callback, use the example below.

// remove the filter 
add_filter( 'postbox_classes_screen_id_box_id', 'add_metabox_classes', 10, 1 ); 
JOIN 100,000+ SUBSCRIBER's FAMILY

 Subscribe to our weekly newsletter below and never miss the latest updates in WordPress