wc_selected( string|int $value, string|int|array $options )
Return the html selected attribute if stringified $value is found in array of stringified $options or if stringified $value is the same as scalar stringified $options.
Description Description
Parameters Parameters
- $value
-
(Required) Value to find within options.
- $options
-
(Required) Options to go through when looking for value.
Return Return
(string)
Source Source
File: includes/wc-core-functions.php
function wc_selected( $value, $options ) { if ( is_array( $options ) ) { $options = array_map( 'strval', $options ); return selected( in_array( (string) $value, $options, true ), true, false ); } return selected( $value, $options, false ); }