WC_Shop_Customizer::sanitize_default_catalog_orderby( string $value )
Sanitize the catalog orderby setting.
Description Description
Parameters Parameters
- $value
-
(Required) An array key from the below array.
Return Return
(string)
Source Source
File: includes/customizer/class-wc-shop-customizer.php
public function sanitize_default_catalog_orderby( $value ) {
$options = apply_filters(
'woocommerce_default_catalog_orderby_options',
array(
'menu_order' => __( 'Default sorting (custom ordering + name)', 'woocommerce' ),
'popularity' => __( 'Popularity (sales)', 'woocommerce' ),
'rating' => __( 'Average rating', 'woocommerce' ),
'date' => __( 'Sort by most recent', 'woocommerce' ),
'price' => __( 'Sort by price (asc)', 'woocommerce' ),
'price-desc' => __( 'Sort by price (desc)', 'woocommerce' ),
)
);
return array_key_exists( $value, $options ) ? $value : 'menu_order';
}