get_hidden_meta_boxes() - WordPress 函数参考中文文档

返回介绍

get_hidden_meta_boxes()

发布于 2017-09-10 字数2851 浏览 972 评论 0

get_hidden_meta_boxes( string|WP_Screen $screen )

Get Hidden Meta Boxes


描述


参数

$screen

(string|WP_Screen)
(Required)
Screen identifier


返回值

(array) Hidden Meta Boxes


源代码

File: wp-admin/includes/screen.php

function get_hidden_meta_boxes( $screen ) {
	if ( is_string( $screen ) )
		$screen = convert_to_screen( $screen );

	$hidden = get_user_option( "metaboxhidden_{$screen->id}" );

	$use_defaults = ! is_array( $hidden );

	// Hide slug boxes by default
	if ( $use_defaults ) {
		$hidden = array();
		if ( 'post' == $screen->base ) {
			if ( 'post' == $screen->post_type || 'page' == $screen->post_type || 'attachment' == $screen->post_type )
				$hidden = array('slugdiv', 'trackbacksdiv', 'postcustom', 'postexcerpt', 'commentstatusdiv', 'commentsdiv', 'authordiv', 'revisionsdiv');
			else
				$hidden = array( 'slugdiv' );
		}

		/**
		 * Filters the default list of hidden meta boxes.
		 *
		 * @since 3.1.0
		 *
		 * @param array     $hidden An array of meta boxes hidden by default.
		 * @param WP_Screen $screen WP_Screen object of the current screen.
		 */
		$hidden = apply_filters( 'default_hidden_meta_boxes', $hidden, $screen );
	}

	/**
	 * Filters the list of hidden meta boxes.
	 *
	 * @since 3.3.0
	 *
	 * @param array     $hidden       An array of hidden meta boxes.
	 * @param WP_Screen $screen       WP_Screen object of the current screen.
	 * @param bool      $use_defaults Whether to show the default meta boxes.
	 *                                Default true.
	 */
	return apply_filters( 'hidden_meta_boxes', $hidden, $screen, $use_defaults );
}

更新日志

Version 描述
2.7.0 Introduced.

相关函数

Uses

  • wp-admin/includes/screen.php:
    default_hidden_meta_boxes
  • wp-admin/includes/screen.php:
    hidden_meta_boxes
  • wp-admin/includes/template.php:
    convert_to_screen()
  • wp-includes/plugin.php:
    apply_filters()
  • wp-includes/user.php:
    get_user_option()

Used By

  • wp-admin/includes/screen.php:
    meta_box_prefs()
  • wp-admin/includes/template.php:
    do_meta_boxes()
  • wp-admin/includes/template.php:
    do_accordion_sections()
  • wp-admin/includes/meta-boxes.php:
    post_comment_meta_box()

User Contributed Notes

上一篇:get_hidden_columns()

下一篇:get_home_path()

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

目前还没有任何评论,快来抢沙发吧!