wc_products_array_orderby_modified

Sort by modified.

Description

(int) wc_products_array_orderby_modified( (WC_Product) $a, (WC_Product) $b ); 

Returns (int)

Parameters (2)

0. $a (WC_Product)
Object $a
1. $b (WC_Product)
Object $b

Usage

  1. if ( !function_exists( 'wc_products_array_orderby_modified' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-product-functions.php'; 
  3.  
  4. // object $a 
  5. $a = null; 
  6.  
  7. // object $b 
  8. $b = null; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = wc_products_array_orderby_modified($a, $b); 
  12.  

Defined (1)

The function is defined in the following location(s).

/includes/wc-product-functions.php  
  1. function wc_products_array_orderby_modified( $a, $b ) { 
  2. if ( $a->get_date_modified() === $b->get_date_modified() ) { 
  3. return 0; 
  4. return ( $a->get_date_modified() < $b->get_date_modified() ) ? -1 : 1;