Skip to content

Commit

Permalink
Use wp_list_pluck() over looping through arrays again.
Browse files Browse the repository at this point in the history
  • Loading branch information
JJJ committed Apr 7, 2017
1 parent 31275e2 commit 446e073
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions wp-site-aliases/includes/functions/cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,14 @@ function update_site_alias_cache( $aliases = array(), $update_meta_cache = true
return;
}

// Setup array for IDs
$alias_ids = array();

// Loop through aliases & add them to cache group
foreach ( $aliases as $alias ) {
$alias_ids[] = $alias->id;
wp_cache_add( $alias->id, $alias, 'blog-aliases' );
}

// Maybe update site alias meta cache
if ( true === $update_meta_cache ) {
update_site_aliasmeta_cache( $alias_ids );
update_site_aliasmeta_cache( wp_list_pluck( $aliases, 'id' ) );
}
}

Expand Down

0 comments on commit 446e073

Please sign in to comment.