Filter hook 'get_the_time'

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

View Source

get_the_time

Filter Hook
Description
Filters the time of the post.

Hook Information

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

Hook Parameters

Type Name Description
string|int $the_time Formatted date string or Unix timestamp if `$format` is 'U' or 'G'.
string $format Format to use for retrieving the time the post was written. Accepts 'G', 'U', or PHP date format.
WP_Post $post Post object.

Usage Examples

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

function my_custom_filter($the_time, $format, $post) {
    // Your custom filtering logic here
    return $the_time;
}

Source Code Context

wp-includes/general-template.php:2857 - How this hook is used in WordPress core
<?php
2852  	 * @param string|int $the_time Formatted date string or Unix timestamp if `$format` is 'U' or 'G'.
2853  	 * @param string     $format   Format to use for retrieving the time the post
2854  	 *                             was written. Accepts 'G', 'U', or PHP date format.
2855  	 * @param WP_Post    $post     Post object.
2856  	 */
2857  	return apply_filters( 'get_the_time', $the_time, $format, $post );
2858  }
2859  
2860  /**
2861   * Retrieves the localized time of the post.
2862   *

PHP Documentation

<?php
/**
	 * Filters the time of the post.
	 *
	 * @since 1.5.0
	 *
	 * @param string|int $the_time Formatted date string or Unix timestamp if `$format` is 'U' or 'G'.
	 * @param string     $format   Format to use for retrieving the time the post
	 *                             was written. Accepts 'G', 'U', or PHP date format.
	 * @param WP_Post    $post     Post object.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 3
  • File: wp-includes/general-template.php
Related Hooks

Related hooks will be displayed here in future updates.