Title: wp_set_option_autoload
Published: November 8, 2023
Last modified: May 20, 2026

---

# wp_set_option_autoload( string $option, bool $autoload ): bool

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/wp_set_option_autoload/?output_format=md#description)
    - [See also](https://developer.wordpress.org/reference/functions/wp_set_option_autoload/?output_format=md#see-also)
 * [Parameters](https://developer.wordpress.org/reference/functions/wp_set_option_autoload/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/wp_set_option_autoload/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/wp_set_option_autoload/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/wp_set_option_autoload/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/wp_set_option_autoload/?output_format=md#changelog)

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

Sets the autoload value for an option in the database.

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

This is a wrapper for [wp_set_option_autoload_values()](https://developer.wordpress.org/reference/functions/wp_set_option_autoload_values/),
which can be used to set the autoload value for multiple options at once.

### 󠀁[See also](https://developer.wordpress.org/reference/functions/wp_set_option_autoload/?output_format=md#see-also)󠁿

 * [wp_set_option_autoload_values()](https://developer.wordpress.org/reference/functions/wp_set_option_autoload_values/)

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

 `$option`stringrequired

Name of the option. Expected to not be SQL-escaped.

`$autoload`boolrequired

Autoload value to control whether to load the option when WordPress starts up.
 
For backward compatibility `'yes'` and `'no'` are also accepted, though using these
values is deprecated.

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

 bool True if the autoload value was modified, false otherwise.

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

    ```php
    function wp_set_option_autoload( $option, $autoload ) {
    	$result = wp_set_option_autoload_values( array( $option => $autoload ) );
    	return $result[ $option ] ?? false;
    }
    ```

[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#L548)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/option.php#L548-L551)

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

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

Sets the autoload values for multiple options in the database.

  |

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

| Version | Description | 
| [6.7.0](https://developer.wordpress.org/reference/since/6.7.0/) | The autoload values `'yes'` and `'no'` are deprecated. | 
| [6.4.0](https://developer.wordpress.org/reference/since/6.4.0/) | Introduced. |

## User Contributed Notes

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