Automatically whitelist screen options added via add_screen_option()
|Reported by:||mdawaffe||Owned by:|
set_screen_options() currently maintains a hardcoded whitelist of screens that can set options.
The list is extendable via the filter:
apply_filters('set-screen-option', false, $option, $value);
but that's sort of a pain. If a plugin calls add_screen_option(), it should be added to the whitelist automatically.
Also note that set_screen_options() is called so early, there's no convenient place for plugins to add to the set-screen-option filter. The best workaround I've been able to come up with is to manually call set_screen_options() again inside the page's load-$hook.
Example naive plugin code that does not work in <=3.3.
# Inside a menu page's load-$hook // Display per-page settings in screen options add_screen_option( 'per_page', array( 'label' => __( 'Things' ) ) );
Change History (5)
- Keywords 3.4-early added
- Milestone changed from Awaiting Review to Future Release
- Component changed from Plugins to Admin APIs
- Keywords needs-patch added; 3.4-early removed