Title: form_option
Published: April 25, 2014
Last modified: April 28, 2025

---

# form_option( string $option )

## In this article

 * [Parameters](https://developer.wordpress.org/reference/functions/form_option/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/functions/form_option/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/form_option/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/form_option/?output_format=md#changelog)

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

Prints option value after sanitizing for forms.

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

 `$option`stringrequired

Option name.

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

    ```php
    function form_option( $option ) {
    	echo esc_attr( get_option( $option ) );
    }
    ```

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

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

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

Escaping for HTML attributes.

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

Retrieves an option value based on an option name.

  |

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

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

## User Contributed Notes

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