[wp-hackers] Multiblog Queries

Dagan Henderson dagan at digitalconversations.tv
Mon Jan 23 00:11:11 UTC 2012

I'm working on a project that requires pulling posts from other blogs in
the same multiblog installation. The best method I've found involves using
the switch_to_blog() function, but this function's documentation points out
that it is a rather expensive process. Even so, I need to do it.

To make the process as painless and effecient as possible, I've begun
developing a Multiblog_Query class that can be directed to retrieve custom
queries from other blogs in the installation and, optionally, merge the
results with the current WP_Query object. I've also included options for
retrieving thumbnails and metadata and making them available during the
loop without additional DB calls.

If you're interested in doing something similar, I've published my class to
a public repository on GitHub (
https://github.com/dagan/WordPress-Multi-Blog-Queries). It's still in beta,
but I'll be maintaining the project and addressing any issues opened.

Hopefully someone finds it helpful. That would make me feel better about
doing the work. :-)


+Dagan Henderson <https://plus.google.com/u/1/114843896766761433534>
@TechDagan <http://twitter.com/TechDagan>


More information about the wp-hackers mailing list