WordPress.org

Make WordPress Core

Changeset 34935


Ignore:
Timestamp:
10/08/2015 05:56:57 AM (4 years ago)
Author:
pento
Message:

Posts: Add the pre_get_lastpostmodified filter to get_lastpostmodified().

This allows get_lastpostmodified() to be short circuited when the site wants to avoid running the occasionally slow queries in _get_last_post_time().

Fixes #34205.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/post-functions.php

    r34891 r34935  
    53265326 */
    53275327function get_lastpostmodified( $timezone = 'server', $post_type = 'any' ) {
     5328    /**
     5329     * Pre-filter the return value of get_lastpostmodified() before the query is run.
     5330     *
     5331     * @since 4.4.0
     5332     *
     5333     * @param string $lastpostmodified Date the last post was modified.
     5334     *                                 Returning anything other than false will short-circuit the function.
     5335     * @param string $timezone         Location to use for getting the post modified date.
     5336     *                                 See {@see get_lastpostdate()} for accepted `$timezone` values.
     5337     * @param string $post_type        The post type to check.
     5338     */
     5339    $lastpostmodified = apply_filters( 'pre_get_lastpostmodified', false, $timezone, $post_type );
     5340    if ( false !== $lastpostmodified ) {
     5341        return $lastpostmodified;
     5342    }
     5343
    53285344    $lastpostmodified = _get_last_post_time( $timezone, 'modified', $post_type );
    53295345
Note: See TracChangeset for help on using the changeset viewer.