wc_selected()
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.
Хуков нет.
Возвращает
string.
Использование
wc_selected( $value, $options );
- $value(строка|int) (обязательный)
- Value to find within options.
- $options(строка|int|массив) (обязательный)
- Options to go through when looking for value.
Код wc_selected() wc selected WC 11.1.2
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 );
}