the_date

Filters the date a post was published for display.

Description

apply_filters( 'the_date', (string) $the_date, (string) $d, (string) $before, (string) $after ); 

Parameters (4)

0. $the_date (string)
The formatted date string.
1. $d (string)
PHP date format. Defaults to date_format option if not specified.
2. $before (string)
HTML output before the date.
3. $after (string)
HTML output after the date.

Usage

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

Defined (1)

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

/wp-includes/general-template.php  
  1. $the_date = apply_filters( 'the_date', $the_date, $d, $before, $after );