Filter hook 'the_date'

in WP Core File wp-includes/general-template.php at line 2690

View Source

the_date

Filter Hook
Description
Filters the date of the post, for display.

Hook Information

File Location wp-includes/general-template.php View on GitHub
Hook Type Filter
Line Number 2690

Hook Parameters

Type Name Description
string $the_date The formatted date string.
string $format PHP date format.
string $before HTML output before the date.
string $after HTML output after the date.

Usage Examples

Basic Usage
<?php
// Hook into the_date
add_filter('the_date', 'my_custom_filter', 10, 4);

function my_custom_filter($the_date, $format, $before, $after) {
    // Your custom filtering logic here
    return $the_date;
}

Source Code Context

wp-includes/general-template.php:2690 - How this hook is used in WordPress core
<?php
2685  	 * @param string $the_date The formatted date string.
2686  	 * @param string $format   PHP date format.
2687  	 * @param string $before   HTML output before the date.
2688  	 * @param string $after    HTML output after the date.
2689  	 */
2690  	$the_date = apply_filters( 'the_date', $the_date, $format, $before, $after );
2691  
2692  	if ( $display ) {
2693  		echo $the_date;
2694  	} else {
2695  		return $the_date;

PHP Documentation

<?php
/**
	 * Filters the date of the post, for display.
	 *
	 * @since 0.71
	 *
	 * @param string $the_date The formatted date string.
	 * @param string $format   PHP date format.
	 * @param string $before   HTML output before the date.
	 * @param string $after    HTML output after the date.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 4
  • File: wp-includes/general-template.php
Related Hooks

Related hooks will be displayed here in future updates.