Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: get_lastpostmodified

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

This hook occurs 2 times in this file.

Line Code
3937  */
3938 function get_lastpostmodified($timezone = 'server') {
3939      global $wpdb;
3940
3941      $add_seconds_server = date('Z');
3942      $timezone = strtolower( $timezone );
3943
3944      $lastpostmodified = wp_cache_get( "lastpostmodified:$timezone", 'timeinfo' );
3945      if ( $lastpostmodified )
3946           return apply_filters( 'get_lastpostmodified', $lastpostmodified, $timezone );
3947
3948      switch ( strtolower($timezone) ) {
3949           case 'gmt':
3950                $lastpostmodified = $wpdb->get_var("SELECT post_modified_gmt FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post' ORDER BY post_modified_gmt DESC LIMIT 1");
3951                break;
3952           case 'blog':
3953                $lastpostmodified = $wpdb->get_var("SELECT post_modified FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post' ORDER BY post_modified_gmt DESC LIMIT 1");
3954                break;
3955           case 'server':
 
Line Code
3958      }
3959
3960      $lastpostdate = get_lastpostdate($timezone);
3961      if ( $lastpostdate > $lastpostmodified )
3962           $lastpostmodified = $lastpostdate;
3963
3964      if ( $lastpostmodified )
3965           wp_cache_set( "lastpostmodified:$timezone", $lastpostmodified, 'timeinfo' );
3966
3967      return apply_filters( 'get_lastpostmodified', $lastpostmodified, $timezone );
3968 }
3969
3970 /**
3971  * Updates posts in cache.
3972  *
3973  * @usedby update_page_cache() Aliased by this function.
3974  *
3975  * @package WordPress
3976  * @subpackage Cache