diff options
author | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2008-09-15 15:45:31 +0000 |
---|---|---|
committer | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2008-09-15 15:45:31 +0000 |
commit | 0bea7c7ad2ee8e82a86919b1cd2fea517cc67ec8 (patch) | |
tree | 5b95d4a59dbb761f8da80c9e894d22a7a547b00c /wp-includes/post.php | |
parent | 66b0871abeef45cdbe757c97a643076503b6c656 (diff) | |
download | wordpress-mu-0bea7c7ad2ee8e82a86919b1cd2fea517cc67ec8.tar.gz wordpress-mu-0bea7c7ad2ee8e82a86919b1cd2fea517cc67ec8.tar.xz wordpress-mu-0bea7c7ad2ee8e82a86919b1cd2fea517cc67ec8.zip |
Merge with WP 2.6.2
git-svn-id: http://svn.automattic.com/wordpress-mu/branches/2.6@1471 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes/post.php')
-rw-r--r-- | wp-includes/post.php | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/wp-includes/post.php b/wp-includes/post.php index bf7d922..54ce668 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -465,7 +465,7 @@ function get_posts($args = null) { 'order' => 'DESC', 'include' => '', 'exclude' => '', 'meta_key' => '', 'meta_value' =>'', 'post_type' => 'post', - 'post_parent' => 0 + 'post_parent' => 0, 'suppress_filters' => true ); $r = wp_parse_args( $args, $defaults ); @@ -594,27 +594,20 @@ function get_post_meta($post_id, $key, $single = false) { $meta_cache = wp_cache_get($post_id, 'post_meta'); + if ( !$meta_cache ) { + update_postmeta_cache($post_id); + $meta_cache = wp_cache_get($post_id, 'post_meta'); + } + if ( isset($meta_cache[$key]) ) { if ( $single ) { return maybe_unserialize( $meta_cache[$key][0] ); } else { - return maybe_unserialize( $meta_cache[$key] ); + return array_map('maybe_unserialize', $meta_cache[$key]); } } - if ( !$meta_cache ) { - update_postmeta_cache($post_id); - $meta_cache = wp_cache_get($post_id, 'post_meta'); - } - - if ( $single ) { - if ( isset($meta_cache[$key][0]) ) - return maybe_unserialize($meta_cache[$key][0]); - else - return ''; - } else { - return maybe_unserialize($meta_cache[$key]); - } + return ''; } /** @@ -3297,7 +3290,7 @@ function _wp_put_post_revision( $post = null, $autosave = false ) { if ( !$post || empty($post['ID']) ) return; - if ( isset($post['post_type']) && 'revision' == $post_post['type'] ) + if ( isset($post['post_type']) && 'revision' == $post['post_type'] ) return new WP_Error( 'post_type', __( 'Cannot create a revision of a revision' ) ); $post = _wp_post_revision_fields( $post, $autosave ); |