Changeset 43729 for branches/5.0/src/wp-includes/post.php
- Timestamp:
- 10/15/2018 11:45:16 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/5.0/src/wp-includes/post.php
r43710 r43729 1785 1785 function add_post_meta( $post_id, $meta_key, $meta_value, $unique = false ) { 1786 1786 // Make sure meta is added to the post, not a revision. 1787 if ( $the_post = wp_is_post_revision($post_id) ) 1787 $the_post = wp_is_post_revision( $post_id ); 1788 if ( $the_post ) { 1788 1789 $post_id = $the_post; 1789 1790 $added = add_metadata( 'post', $post_id, $meta_key, $meta_value, $unique ); 1791 if ( $added ) { 1792 wp_cache_set( 'last_changed', microtime(), 'posts' ); 1793 } 1794 return $added; 1790 } 1791 1792 return add_metadata( 'post', $post_id, $meta_key, $meta_value, $unique ); 1795 1793 } 1796 1794 … … 1812 1810 function delete_post_meta( $post_id, $meta_key, $meta_value = '' ) { 1813 1811 // Make sure meta is added to the post, not a revision. 1814 if ( $the_post = wp_is_post_revision($post_id) ) 1812 $the_post = wp_is_post_revision( $post_id ); 1813 if ( $the_post ) { 1815 1814 $post_id = $the_post; 1816 1817 $deleted = delete_metadata( 'post', $post_id, $meta_key, $meta_value ); 1818 if ( $deleted ) { 1819 wp_cache_set( 'last_changed', microtime(), 'posts' ); 1820 } 1821 return $deleted; 1815 } 1816 1817 return delete_metadata( 'post', $post_id, $meta_key, $meta_value ); 1822 1818 } 1823 1819 … … 1858 1854 function update_post_meta( $post_id, $meta_key, $meta_value, $prev_value = '' ) { 1859 1855 // Make sure meta is added to the post, not a revision. 1860 if ( $the_post = wp_is_post_revision($post_id) ) 1856 $the_post = wp_is_post_revision( $post_id ); 1857 if ( $the_post ) { 1861 1858 $post_id = $the_post; 1862 1863 $updated = update_metadata( 'post', $post_id, $meta_key, $meta_value, $prev_value ); 1864 if ( $updated ) { 1865 wp_cache_set( 'last_changed', microtime(), 'posts' ); 1866 } 1867 return $updated; 1859 } 1860 1861 return update_metadata( 'post', $post_id, $meta_key, $meta_value, $prev_value ); 1868 1862 } 1869 1863 … … 1877 1871 */ 1878 1872 function delete_post_meta_by_key( $post_meta_key ) { 1879 $deleted = delete_metadata( 'post', null, $post_meta_key, '', true ); 1880 if ( $deleted ) { 1881 wp_cache_set( 'last_changed', microtime(), 'posts' ); 1882 } 1883 return $deleted; 1873 return delete_metadata( 'post', null, $post_meta_key, '', true ); 1884 1874 } 1885 1875 … … 6476 6466 return $clauses; 6477 6467 } 6468 6469 /** 6470 * Sets the last changed time for the 'posts' cache group. 6471 * 6472 * @since 5.0.0 6473 */ 6474 function wp_cache_set_posts_last_changed() { 6475 wp_cache_set( 'last_changed', microtime(), 'posts' ); 6476 }
Note: See TracChangeset
for help on using the changeset viewer.