Filter hook 'get_lastpostdate'

in WP Core File wp-includes/post.php at line 7470

View Source

get_lastpostdate

Filter Hook
Description
Filters the most recent time that a post on the site was published.

Hook Information

File Location wp-includes/post.php View on GitHub
Hook Type Filter
Line Number 7470

Hook Parameters

Type Name Description
string|false $lastpostdate The most recent time that a post was published, in 'Y-m-d H:i:s' format. False on failure.
string $timezone Location to use for getting the post published date. See get_lastpostdate() for accepted `$timezone` values.
string $post_type The post type to check.

Usage Examples

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

function my_custom_filter($lastpostdate, $timezone, $post_type) {
    // Your custom filtering logic here
    return $lastpostdate;
}

Source Code Context

wp-includes/post.php:7470 - How this hook is used in WordPress core
<?php
7465  	 *                                   in 'Y-m-d H:i:s' format. False on failure.
7466  	 * @param string       $timezone     Location to use for getting the post published date.
7467  	 *                                   See get_lastpostdate() for accepted `$timezone` values.
7468  	 * @param string       $post_type    The post type to check.
7469  	 */
7470  	return apply_filters( 'get_lastpostdate', $lastpostdate, $timezone, $post_type );
7471  }
7472  
7473  /**
7474   * Gets the most recent time that a post on the site was modified.
7475   *

PHP Documentation

<?php
/**
	 * Filters the most recent time that a post on the site was published.
	 *
	 * @since 2.3.0
	 * @since 5.5.0 Added the `$post_type` parameter.
	 *
	 * @param string|false $lastpostdate The most recent time that a post was published,
	 *                                   in 'Y-m-d H:i:s' format. False on failure.
	 * @param string       $timezone     Location to use for getting the post published date.
	 *                                   See get_lastpostdate() for accepted `$timezone` values.
	 * @param string       $post_type    The post type to check.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 3
  • File: wp-includes/post.php
Related Hooks

Related hooks will be displayed here in future updates.