Title: wp_determine_option_autoload_value
Published: July 16, 2024
Last modified: May 20, 2026

---

# wp_determine_option_autoload_value( string $option, mixed $value, mixed $serialized_value, bool|null $autoload ): string

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/wp_determine_option_autoload_value/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/functions/wp_determine_option_autoload_value/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/wp_determine_option_autoload_value/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/wp_determine_option_autoload_value/?output_format=md#source)
 * [Hooks](https://developer.wordpress.org/reference/functions/wp_determine_option_autoload_value/?output_format=md#hooks)
 * [Related](https://developer.wordpress.org/reference/functions/wp_determine_option_autoload_value/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/wp_determine_option_autoload_value/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/wp_determine_option_autoload_value/?output_format=md#wp--skip-link--target)

This function’s access is marked private. This means it is not intended for use 
by plugin or theme developers, only by core. It is listed here for completeness.

Determines the appropriate autoload value for an option based on input.

## 󠀁[Description](https://developer.wordpress.org/reference/functions/wp_determine_option_autoload_value/?output_format=md#description)󠁿

This function checks the provided autoload value and returns a standardized value(‘
on’, ‘off’, ‘auto-on’, ‘auto-off’, or ‘auto’) based on specific conditions.

If no explicit autoload value is provided, the function will check for certain heuristics
around the given option.
It will return `auto-on` to indicate autoloading, `auto-
off` to indicate not autoloading, or `auto` if no clear decision could be made.

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/wp_determine_option_autoload_value/?output_format=md#parameters)󠁿

 `$option`stringrequired

The name of the option.

`$value`mixedrequired

The value of the option to check its autoload value.

`$serialized_value`mixedrequired

The serialized value of the option to check its autoload value.

`$autoload`bool|nullrequired

The autoload value to check.
 Accepts `'on'|true` to enable or `'off'|false` to 
disable, or `'auto-on'`, `'auto-off'`, or `'auto'` for internal purposes. Any other
autoload value will be forced to either `'auto-on'`, `'auto-off'`, or `'auto'`. `'
yes'` and `'no'` are supported for backward compatibility.

## 󠀁[Return](https://developer.wordpress.org/reference/functions/wp_determine_option_autoload_value/?output_format=md#return)󠁿

 string Returns the original $autoload value if explicit, or `'auto-on'`, `'auto-
off'`, or `'auto'` depending on default heuristics.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/wp_determine_option_autoload_value/?output_format=md#source)󠁿

    ```php
    function wp_determine_option_autoload_value( $option, $value, $serialized_value, $autoload ) {

    	// Check if autoload is a boolean.
    	if ( is_bool( $autoload ) ) {
    		return $autoload ? 'on' : 'off';
    	}

    	switch ( $autoload ) {
    		case 'on':
    		case 'yes':
    			return 'on';
    		case 'off':
    		case 'no':
    			return 'off';
    	}

    	/**
    	 * Allows to determine the default autoload value for an option where no explicit value is passed.
    	 *
    	 * @since 6.6.0
    	 *
    	 * @param bool|null $autoload         The default autoload value to set. Returning true will be set as 'auto-on' in the
    	 *                                    database, false will be set as 'auto-off', and null will be set as 'auto'.
    	 * @param string    $option           The passed option name.
    	 * @param mixed     $value            The passed option value to be saved.
    	 * @param mixed     $serialized_value The passed option value to be saved, in serialized form.
    	 */
    	$autoload = apply_filters( 'wp_default_autoload_value', null, $option, $value, $serialized_value );
    	if ( is_bool( $autoload ) ) {
    		return $autoload ? 'auto-on' : 'auto-off';
    	}

    	return 'auto';
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/option.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/option.php#L1304)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/option.php#L1304-L1337)

## 󠀁[Hooks](https://developer.wordpress.org/reference/functions/wp_determine_option_autoload_value/?output_format=md#hooks)󠁿

 [apply_filters( ‘wp_default_autoload_value’, bool|null $autoload, string $option, mixed $value, mixed $serialized_value )](https://developer.wordpress.org/reference/hooks/wp_default_autoload_value/)

Allows to determine the default autoload value for an option where no explicit value
is passed.

## 󠀁[Related](https://developer.wordpress.org/reference/functions/wp_determine_option_autoload_value/?output_format=md#related)󠁿

| Uses | Description | 
| [apply_filters()](https://developer.wordpress.org/reference/functions/apply_filters/)`wp-includes/plugin.php` |

Calls the callback functions that have been added to a filter hook.

  |

| Used by | Description | 
| [update_option()](https://developer.wordpress.org/reference/functions/update_option/)`wp-includes/option.php` |

Updates the value of an option that was already added.

  | 
| [add_option()](https://developer.wordpress.org/reference/functions/add_option/)`wp-includes/option.php` |

Adds a new option.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/wp_determine_option_autoload_value/?output_format=md#changelog)󠁿

| Version | Description | 
| [6.6.0](https://developer.wordpress.org/reference/since/6.6.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_determine_option_autoload_value%2F)
before being able to contribute a note or feedback.