WordPress.org

Ready to get started?Download WordPress

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Difference between revisions of "Function Reference/sanitize option"

(Include information about the function)
(No difference)

Revision as of 15:51, 17 December 2012

Description

Sanitizes various option values based on the nature of the option.

This is basically a switch statement which will pass $value through a number of functions depending on the $option.

Usage

<?php sanitize_option( $option, $value ); ?>

Parameters

$option
(string) (required) The name of the option.
Default: None
$value
(string) (required) The unsanitized value.
Default: None

Return Values

(string) 
Sanitized Value.

Examples

Notes

Filters

  • 'sanitize_option_$option':
    apply_filters( 'sanitize_option_$option', $value, $option )

Change Log

Since: 2.0.5

Source File

sanitize_option() is located in wp-includes/formatting.php.

Related Functions

sanitize_option() is in a class of functions that help you sanitize potentially unsafe data which allow you to pass an arbitrary variable and receive the clean version based on data type. Others include:

Related