woocommerce_default_catalog_orderby_options
Sanitize the catalog orderby setting.
Usage
add_filter( 'woocommerce_default_catalog_orderby_options', 'wp_kama_woocommerce_default_catalog_orderby_options_filter' ); /** * Function for `woocommerce_default_catalog_orderby_options` filter-hook. * * @param string $value An array key from the below array. * * @return string */ function wp_kama_woocommerce_default_catalog_orderby_options_filter( $value ){ // filter... return $value; }
- $value(string)
- An array key from the below array.
Where the hook is called
woocommerce_default_catalog_orderby_options
woocommerce_default_catalog_orderby_options
woocommerce/includes/customizer/class-wc-shop-customizer.php 273-283
$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' ), ) );
woocommerce/includes/customizer/class-wc-shop-customizer.php 443-453
'choices' => 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' ), ) ),