apply_filters( 'set-screen-option', bool $keep, string $option, int $value )

Filters a screen option value before it is set.


Description Description

The filter can also be used to modify non-standard [items]_per_page settings. See the parent function for a full list of standard options.

Returning false to the filter will skip saving the current option.

See also See also


Top ↑

Parameters Parameters

$keep

(bool) Whether to save or skip saving the screen option value. Default false.

$option

(string) The option name.

$value

(int) The number of rows to use.


Top ↑

Source Source

File: wp-admin/includes/misc.php

View on Trac


Top ↑

Changelog Changelog

Changelog
Version Description
2.8.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

  1. Skip to note 1 content

    This cannot be called too late in the WordPress action stack or it will not fire at the right time. You cannot put it inside a function running during the ‘admin_menu’ hook, for example. For the Store Locator Plus plugin (you can find up-to-date working code buried in there) I find adding the filter inside the WordPress ‘init’ methods works best as this is called early in the WordPress action stack.

    The “sister” add_screen_option() call, however, tends to work better later in the call stack such as within the ‘admin_menu’ hook.

    The general premise: save the options goes before (WP ‘init’ hook) setting up the options (WP ‘admin_menu’ hook).

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