开发者

WordPressMU - get blog list, alphabetically sorted by blogname

In WordPress MU, I've tried writing my own query for this but can't seem to get all of the joins I really need. The result set I'm looking for would be something like:

blog_id
blog name
blog path
owner first name
owner last name

and return it all alphabetically, by blog name. The trouble I'm having is that the first and last name of the blog owner are in wp_usermeta, the blog id and path ar开发者_JAVA百科e in wp_blogs, and the blog name is in wp_[blog id here]_options, with wp_usermeta requiring the user ID from wp_users.

Is it possible to join all of this in one query?


There is not a way to combine all of the information into one result set because of the way WPMU handles the database table names.

The best solution I have come up with is some PHP logic that gets the blogs from the wp_blogs table, uses the IDs there to gather information from the wp_X_options tables, and then builds up the information I need. It's the same reason there is no good way to get a list of all the posts across all of the blogs with just a query. You need backend logic to build the query based on the blogs in wp_blogs.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜