Developer’s Corner: Useful MU Helper Functions for WPMU and BuddyPress

This week a new plugin for WPMU and BuddyPress quietly slipped into the repository with hardly a mention. The MU-Helpers plugin was written by Eric Marden to help make your life easier when developing solutions for WPMU and BuddyPress. Currently the plugin provides two functions that WPMU developers cannot live without: a function to return all posts from all blogs and one to return all comments on all blogs.

Get All Blog Posts

This function returns a sorted array of all posts across all blogs on the MU install using a quicksort algorithm to ensure that the list is in the order you specify. It uses the same Order By Paramaters as query_posts. The sort param is the column name in the database you want to sort on.


{code type=php}
get_all_blog_posts( $num_per_blog = 1, $orderby = ‘date’, $sort = ‘post_date_gmt’ )

Get All Blog Comments

This function returns a sorted array of all comments across all blogs on the MU install. It uses the same Order By Paramaters as get_comments.


{code type=php}
get_all_blog_comments( $num_per_blog = 1, $orderby = ‘comment_date_gmt’, $sort = ‘comment_date_gmt’ )

Please note that this plugin has not been tested with the new WordPress 3.0 Multi-Site Network. If you have a 3.0 MU install, feel free to test and let us know in the comments how it’s working.

MU-Helpers was created to be an evolving library of functions that will help to make life easier for developers. It’s still under active development. You can take a peek at its code and get involved in contributing to the project at, where it’s currently being hosted. This is one plugin you’re going to want to follow as contributors add more useful functions that will save you time.