Changeset 43982 for trunk/src/wp-includes/post.php
- Timestamp:
- 12/12/2018 03:02:00 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/5.0 merged: 43729
- Property svn:mergeinfo changed
-
trunk/src/wp-includes/post.php
r43638 r43982 1907 1907 function add_post_meta( $post_id, $meta_key, $meta_value, $unique = false ) { 1908 1908 // Make sure meta is added to the post, not a revision. 1909 if ( $the_post = wp_is_post_revision( $post_id ) ) { 1909 $the_post = wp_is_post_revision( $post_id ); 1910 if ( $the_post ) { 1910 1911 $post_id = $the_post; 1911 1912 } 1912 1913 1913 $added = add_metadata( 'post', $post_id, $meta_key, $meta_value, $unique ); 1914 if ( $added ) { 1915 wp_cache_set( 'last_changed', microtime(), 'posts' ); 1916 } 1917 return $added; 1914 return add_metadata( 'post', $post_id, $meta_key, $meta_value, $unique ); 1918 1915 } 1919 1916 … … 1935 1932 function delete_post_meta( $post_id, $meta_key, $meta_value = '' ) { 1936 1933 // Make sure meta is added to the post, not a revision. 1937 if ( $the_post = wp_is_post_revision( $post_id ) ) { 1934 $the_post = wp_is_post_revision( $post_id ); 1935 if ( $the_post ) { 1938 1936 $post_id = $the_post; 1939 1937 } 1940 1938 1941 $deleted = delete_metadata( 'post', $post_id, $meta_key, $meta_value ); 1942 if ( $deleted ) { 1943 wp_cache_set( 'last_changed', microtime(), 'posts' ); 1944 } 1945 return $deleted; 1939 return delete_metadata( 'post', $post_id, $meta_key, $meta_value ); 1946 1940 } 1947 1941 … … 1982 1976 function update_post_meta( $post_id, $meta_key, $meta_value, $prev_value = '' ) { 1983 1977 // Make sure meta is added to the post, not a revision. 1984 if ( $the_post = wp_is_post_revision( $post_id ) ) { 1978 $the_post = wp_is_post_revision( $post_id ); 1979 if ( $the_post ) { 1985 1980 $post_id = $the_post; 1986 1981 } 1987 1982 1988 $updated = update_metadata( 'post', $post_id, $meta_key, $meta_value, $prev_value ); 1989 if ( $updated ) { 1990 wp_cache_set( 'last_changed', microtime(), 'posts' ); 1991 } 1992 return $updated; 1983 return update_metadata( 'post', $post_id, $meta_key, $meta_value, $prev_value ); 1993 1984 } 1994 1985 … … 2002 1993 */ 2003 1994 function delete_post_meta_by_key( $post_meta_key ) { 2004 $deleted = delete_metadata( 'post', null, $post_meta_key, '', true ); 2005 if ( $deleted ) { 2006 wp_cache_set( 'last_changed', microtime(), 'posts' ); 2007 } 2008 return $deleted; 1995 return delete_metadata( 'post', null, $post_meta_key, '', true ); 2009 1996 } 2010 1997 … … 6786 6773 return $clauses; 6787 6774 } 6775 6776 /** 6777 * Sets the last changed time for the 'posts' cache group. 6778 * 6779 * @since 5.0.0 6780 */ 6781 function wp_cache_set_posts_last_changed() { 6782 wp_cache_set( 'last_changed', microtime(), 'posts' ); 6783 }
Note: See TracChangeset
for help on using the changeset viewer.