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

返回介绍

add_screen_option()

发布于 2017-09-10 字数1717 浏览 1077 评论 0

add_screen_option( string $option,  mixed $args = array() )

Register and configure an admin screen option


描述


参数

$option

(string)
(Required)
An option name.

$args

(mixed)
(Optional)
Option-dependent arguments.

Default value: array()


源代码

File: wp-admin/includes/screen.php

function add_screen_option( $option, $args = array() ) {
	$current_screen = get_current_screen();

	if ( ! $current_screen )
		return;

	$current_screen->add_option( $option, $args );
}

更新日志

Version 描述
3.1.0 Introduced.

相关函数

Uses

  • wp-admin/includes/screen.php:
    get_current_screen()

User Contributed Notes

  1. Skip to note content

    You must log in to vote on the helpfulness of this noteVote results for this note: 0You must log in to vote on the helpfulness of this note

    Contributed by Codex

    Example

    Change default columns for network dashboard

    
    add_action( 'wp_network_dashboard_setup', function() {
        add_screen_option( 'layout_columns', array( 'default' => 2 ) );
    } );
    

上一篇:add_role()

下一篇:add_settings_error()

发布评论

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

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