Re-order My Sites

<?php

//Reorder My Sites - Admin Bar
function wco_reorder_my_sites(){
global $wp_admin_bar;
$mysites = $wp_admin_bar->menu->{'my-blogs'}['children'];
unset($wp_admin_bar->menu->{'my-blogs'}['children']);
$pairs = array();
foreach($mysites as $id => $info){ $pairs[$id] = strip_tags($info['title']); }
asort($pairs);
foreach ($pairs as $id => $title){ $wp_admin_bar->menu->{'my-blogs'}['children']->$id = $mysites->{$id}; }
}
add_action('wp_before_admin_bar_render','wco_reorder_my_sites');
?>

0 Comments

You must be logged in to post a comment.