I’m look for a custom SQL query that will let me pull in the latest comments from across a WP multi-site install.
The end result will be identical to a regular recent comments widget, but from all sites within the installation.
Ideas?
Thanks
I’m look for a custom SQL query that will let me pull in the latest comments from across a WP multi-site install.
The end result will be identical to a regular recent comments widget, but from all sites within the installation.
Ideas?
Thanks
You must be logged in to post a comment.
Ok, I did some research based on ×× ××ת ×תר×בs solution here, as I’m interested in this too.
First you need to get a list of blog IDs, and
get_blog_list()
is deprecated because it seems to be a “suicidal database query” 🙂 Anyway looks like there will be a alternative in WP 3.2 called wp_get_sites(). So use this function instead. I suggest you pass the'sort_column => 'last_updated'
argument, and'limit'
the results to 20 or something like that. This would make the next query much faster.So:
Then render the output:
You should also cache the results, and flush the cache like once every 10 minutes or so.
try this:
and you might want to have a look at diamond multisite widgets plugin
witch already implements this a a widget and as a shortcode.
hopes this helps.