wc_products_array_orderby_date()
Sort by date.
No Hooks.
Returns
Int.
Usage
wc_products_array_orderby_date( $a, $b );
- $a(WC_Product) (required)
- First WC_Product object.
- $b(WC_Product) (required)
- Second WC_Product object.
Changelog
| Since 3.0.0 | Introduced. |
wc_products_array_orderby_date() wc products array orderby date code WC 10.3.3
function wc_products_array_orderby_date( $a, $b ) {
if ( $a->get_date_created() === $b->get_date_created() ) {
return 0;
}
return ( $a->get_date_created() < $b->get_date_created() ) ? -1 : 1;
}