WordPress filter hook · part of WordPress core

whitelist_options

A WordPress core filter that 6 plugins also fire themselves, running on 950K+ sites between them.

“This filter is documented in wp-admin/options.php”

How to use whitelist_options

It's a filter: your callback receives the value, and must return the (changed) value. Add this to your theme's functions.php or a small custom plugin:

functions.php
add_filter( 'whitelist_options', function( $whitelist_options ) {
	// Change $whitelist_options here.
	return $whitelist_options;
}, 10, 1 );

Argument names come from WP API Options's source. Other plugins may pass different values: check the call in the plugin you're targeting below.

This hook is fired by WordPress core too. Official reference on developer.wordpress.org →

6 plugins that fire whitelist_options

Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.

  1. Imagify Image Optimization: Optimize Images icon Imagify Image Optimization: Optimize Images900,000+ installs apply_filters_deprecated( 'whitelist_options', [ [] ], '5.5.0', 'allowed_options', __( 'Please consider writing more inclusive code.' ) ) inc/classes/class-imagify-settings.php:375
  2. Theme My Login icon Theme My Login50,000+ installs apply_filters( 'whitelist_options', array() ) admin/settings.php:715
  3. WP API Options icon WP API Options30+ installs apply_filters( 'whitelist_options', $whitelist_options ) includes/wp-api-options-v1.php:186
  4. bbPress Post via Mail icon bbPress Post via Mail10+ installs apply_filters( 'whitelist_options', array() ) library/pvm/Admin.php:276
  5. WP Core Settings Reduction Project icon WP Core Settings Reduction ProjectFewer than 10 installs apply_filters( 'whitelist_options', $whitelist_options ) replacements/options.php:150
  6. Feedbacking icon FeedbackingFewer than 10 installs apply_filters( 'whitelist_options', [] ) src/Dependencies/SettingsBase.php:94

Need a customisation built on this hook?

Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.