Warning: This hook has been deprecated. Use ‘allowed_options’ instead.

apply_filters_deprecated( 'whitelist_options', array $allowed_options )

Filters the allowed options list.


Parameters

$allowed_options

(array) The allowed options list.


Top ↑

Source

File: wp-admin/options.php

View on Trac


Top ↑

Changelog

Changelog
Version Description
5.5.0 Use 'allowed_options' instead.
2.7.0 Introduced.

Top ↑

User Contributed Notes

  1. Skip to note 1 content
    Contributed by arnoutpullen

    Example how to add whitelist_options.

    $sections = array(
    	'section-one' => array(
    		'option-one',
    		'option-two'
    	),
    	'section-two' => array(
    		'option-one',
    		'option-two'
    	),
    );
    
    add_filter('whitelist_options', function($whitelist_options) use ($sections) {
    	foreach($sections as $section => $fields) {
    		foreach($fields as $field) {
    			$whitelist_options[$section][] = $field;
    		}
    	}
    	return $whitelist_options;
    });

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