返回元框使用的类列表。

原型

postbox_classes( string $id, string $page )

参数

$id (string) (Required)

$page (string) (Required)

返回值

(string)  

源文件

路径:wp-admin/includes/post.php

<?php
...
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 array $classes An array of postbox classes.
	 */
	$classes = apply_filters( "postbox_classes_{$page}_{$id}", $classes );
	return implode( ' ', $classes );
}
...
?>

其他

英文文档:https://developer.wordpress.org/reference/functions/postbox_classes/