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.


Top ↑

Return Return

(string)


Top ↑

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';
	}


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.