Filter hook 'get_lastpostmodified'

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

View Source

get_lastpostmodified

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

Hook Information

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

Hook Parameters

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

Usage Examples

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

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

Source Code Context

wp-includes/post.php:7527 - How this hook is used in WordPress core
<?php
7522  	 *                                       in 'Y-m-d H:i:s' format. False on failure.
7523  	 * @param string       $timezone         Location to use for getting the post modified date.
7524  	 *                                       See get_lastpostdate() for accepted `$timezone` values.
7525  	 * @param string       $post_type        The post type to check.
7526  	 */
7527  	return apply_filters( 'get_lastpostmodified', $lastpostmodified, $timezone, $post_type );
7528  }
7529  
7530  /**
7531   * Gets the timestamp of the last time any post was modified or published.
7532   *

PHP Documentation

<?php
/**
	 * Filters the most recent time that a post on the site was modified.
	 *
	 * @since 2.3.0
	 * @since 5.5.0 Added the `$post_type` parameter.
	 *
	 * @param string|false $lastpostmodified The most recent time that a post was modified,
	 *                                       in 'Y-m-d H:i:s' format. False on failure.
	 * @param string       $timezone         Location to use for getting the post modified 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.