• Hello I have network on WP. I want to display all network sites by filtering them by the value of field in the postmeta table. Is there a standard function to do this?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    No. Every site’s post meta is in a separate table. You pretty much need to loop through all sites (“blogs” actually, to conform to table nomenclature) and check the post meta of each respective table to end up with the desired site list.

    Thread Starter Chirukin Bogdan

    (@cheater111)

    Ok, if it value was in options table?

    Moderator bcworkz

    (@bcworkz)

    Every blog has its own options table as well, so the same problem still exists. It’s not really a problem per se, it just complicates getting the data you want. You can still do so, but there is no handy function to do it for you. You would need to code up your own solution.

    If the criteria for blog selection does not change very often, you could save a list of qualifying blogs in one arbitrary place like the main site’s options table. From other blogs, you would need to switch to the main site, get the list, then switch back. Somewhat better than switching to every blog in existence to get one bit of data from each. But keeping that one location list current if the criteria is always changing would be a PITA.

    Is your site sub-domain based or sub-directory? If sub-directory, you could maybe use the sitemeta table if it has each blog’s sub-directory listed there. On my sub-domain site, that table only has one site entry and multiple blog table entries. I suspect sub-directory sites may be the other way around, but IDK.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘WordPress MU’ is closed to new replies.