apply_filters( 'whitelist_options', array $whitelist_options )

Filters the options white list.


Description Description


Parameters Parameters

$whitelist_options

(array) White list options.


Top ↑

Source Source

File: wp-admin/options.php

View on Trac


Top ↑

Changelog Changelog

Changelog
Version Description
2.7.0 Introduced.

Top ↑

User Contributed Notes 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.