pre_get_lastpostmodified
Pre-filter the return value of get_lastpostmodified() before the query is run.
Usage
add_filter( 'pre_get_lastpostmodified', 'wp_kama_pre_get_lastpostmodified_filter', 10, 3 ); /** * Function for `pre_get_lastpostmodified` filter-hook. * * @param string|false $lastpostmodified The most recent time that a post was modified, in 'Y-m-d H:i:s' format, or false. Returning anything other than false will short-circuit the function. * @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. * * @return string|false */ function wp_kama_pre_get_lastpostmodified_filter( $lastpostmodified, $timezone, $post_type ){ // filter... return $lastpostmodified; }
- $lastpostmodified(string|false)
- The most recent time that a post was modified, in 'Y-m-d H:i:s' format, or false. Returning anything other than false will short-circuit the function.
- $timezone(string)
- Location to use for getting the post modified date. See get_lastpostdate() for accepted $timezone values.
- $post_type(string)
- The post type to check.
Changelog
Since 4.4.0 | Introduced. |
Where the hook is called
pre_get_lastpostmodified
wp-includes/post.php 7276
$lastpostmodified = apply_filters( 'pre_get_lastpostmodified', false, $timezone, $post_type );