Exciting News! Flipper Code is now WePlugins! Same commitment to excellence, brand new identity.

How to use postbox_classes_page_id filter in WordPress

Sandeep Kumar Mishra
Sandeep Kumar Mishra
July 9, 2022
5 minutes read

postbox_classes_page_id filter

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

apply_filters( "postbox_classes_{$page}_{$id}", string[] $classes )

Description

This is filter hook , its filter the postbox classes for a specific screen and screen ID combo.
Its consists of two dynamic parameter, one is $page and another is $id.

The dynamic portions of the hook name, $page and $id, refer to the screen and screen ID, respectively.

Parameters

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

Live Example

To run the hook, copy the example below.

apply_filters( "postbox_classes_{$page}_{$id}", string[] $classes )

The following example is for adding a hook callback.

add_filter('postbox_classes_post_postexcerpt','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_post_postexcerpt', 'add_metabox_classes', 10, 1 ); 

Explore the latest in WordPress

Trying to stay on top of it all? Get the best tools, resources and inspiration sent to your inbox every Wednesday.