WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/add screen option

This page is marked as incomplete. You can help Codex by expanding it.

Description

Adds a screen option to the current page.

Usage

<?php
  add_screen_option

      
'per_page',
      array(
'label' => _x'Comments''comments per page (screen options)' )) );
?>

Parameters

$option
(string) (required) An option name.
Default: None
$args
(array) (optional) Option-dependent arguments.
Default: array()

Examples

Change default columns for network dashboard

<?php
add_action('wp_network_dashboard_setup', function() {
    add_screen_option('layout_columns', ['default' => 2]);
});
?>

Change Log

Since: 3.1

Source File

add_screen_option() is located in wp-admin/includes/screen.php.

Related