human_time_diff

Filters the human readable difference between two timestamps.

Description

apply_filters( 'human_time_diff', (string) $since, (int) $diff, (int) $from, (int) $to ); 

Parameters (4)

0. $since (string)
The difference in human readable text.
1. $diff (int)
The difference in seconds.
2. $from (int)
Unix timestamp from which the difference begins.
3. $to (int)
Unix timestamp to end the time difference.

Usage

To run the hook, copy the example below.
  1. $since = apply_filters( 'human_time_diff', $since, $diff, $from, $to ); 
  2.  
  3. if ( !empty( $since ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the human_time_diff callback 
  2. function filter_human_time_diff( $since, $diff, $from, $to ) { 
  3. // make filter magic happen here... 
  4. return $since
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'human_time_diff', 'filter_human_time_diff', 10, 4 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'human_time_diff', 'filter_human_time_diff', 10, 4 ); 

Defined (1)

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

/wp-includes/formatting.php  
  1. return apply_filters( 'human_time_diff', $since, $diff, $from, $to );