Make WordPress Core

Ticket #24266: 24266.diff

File 24266.diff, 865 bytes (added by nofearinc, 10 years ago)

propose update_post_modified_date

  • wp-includes/post.php

     
    54825482}
    54835483
    54845484/**
     5485 * Helper function for updating the post modified date.
     5486 * 
     5487 * @since 4.1
     5488 *
     5489 * @param int $post_id the ID of the Post object.
     5490 */
     5491function update_post_modified_date( $post_id ) {
     5492        $post_modified     = current_time( 'mysql' );
     5493        $post_modified_gmt = current_time( 'mysql', 1 );
     5494       
     5495        $updated_fields = array(
     5496                'post_modified' => $post_modified,
     5497                'post_modified_gmt' => $post_modified_gmt
     5498        );
     5499        $where = array( 'ID' => $post_id );
     5500       
     5501        global $wpdb;
     5502        $wpdb->update( $wpdb->posts, $updated_fields, $where );
     5503       
     5504        clean_post_cache( $post_id );
     5505}
     5506
     5507/**
    54855508 * Call major cache updating functions for list of Post objects.
    54865509 *
    54875510 * @since 1.5.0