postbox_classes( string $id, string $page )

Returns the list of classes to be used by a meta box.


Description Description


Parameters Parameters

$id

(string) (Required)

$page

(string) (Required)


Top ↑

Return Return

(string)


Top ↑

Source Source

File: wp-admin/includes/post.php

1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
function postbox_classes( $id, $page ) {
    if ( isset( $_GET['edit'] ) && $_GET['edit'] == $id ) {
        $classes = array( '' );
    } elseif ( $closed = get_user_option( 'closedpostboxes_' . $page ) ) {
        if ( ! is_array( $closed ) ) {
            $classes = array( '' );
        } else {
            $classes = in_array( $id, $closed ) ? array( 'closed' ) : array( '' );
        }
    } else {
        $classes = array( '' );
    }
 
    /**
     * Filters the postbox classes for a specific screen and screen ID combo.
     *
     * The dynamic portions of the hook name, `$page` and `$id`, refer to
     * the screen and screen ID, respectively.
     *
     * @since 3.2.0
     *
     * @param string[] $classes An array of postbox classes.
     */
    $classes = apply_filters( "postbox_classes_{$page}_{$id}", $classes );
    return implode( ' ', $classes );
}

Top ↑

Changelog Changelog

Changelog
Version Description
2.5.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.