Allow single post ID and comma delimited list of post IDs to be passed to update_postmeta_cache(). Fix default cache to allow storage of empty array. see #5194
git-svn-id: http://svn.automattic.com/wordpress/trunk@6247 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
24af93e9c0
commit
bd5d107814
|
@ -267,7 +267,7 @@ class WP_Object_Cache {
|
|||
if (empty ($group))
|
||||
$group = 'default';
|
||||
|
||||
if (NULL == $data)
|
||||
if (NULL === $data)
|
||||
$data = '';
|
||||
|
||||
$this->cache[$group][$id] = $data;
|
||||
|
|
|
@ -1665,6 +1665,13 @@ function update_postmeta_cache($post_ids) {
|
|||
if ( empty( $post_ids ) )
|
||||
return false;
|
||||
|
||||
if ( !is_array($post_ids) ) {
|
||||
$post_ids = preg_replace('|[^0-9,]|', '', $post_ids);
|
||||
$post_ids = explode(',', $post_ids);
|
||||
}
|
||||
|
||||
$post_ids = array_map('intval', $post_ids);
|
||||
|
||||
$ids = array();
|
||||
foreach ( (array) $post_ids as $id ) {
|
||||
if ( false === wp_cache_get($id, 'post_meta') )
|
||||
|
|
Loading…
Reference in New Issue