4

Can someone explain the difference between WP_Site_Query and WP_Network_Query in WordPress 4.6?

  • WP_Network_Query() : Core class used for querying networks.
  • WP_Site_Query() : Core class used for querying sites.
  • WP_Term_Query() : Class used for querying terms.

Are there examples when you would query the Network vs. the Site vs. Posts?

Wouldn't a WP_Site_Query just be a WP_Query? I've been hoping for a way to query posts across multiple sites but I don't think this is that.

I wonder if Multisite Focused Changes in 4.6 would help...

0

When you set WordPress to multisite, in an "out of box" fashion, you create a single network of sites. Let's, say, a network of food blogs.

With plugins like WP Multi Network you can set up multiple networks. You could split that food blogs network into several networks: mediterranean food blogs, brazilian food blogs, thai food blogs, wine blogs, etc

From what i grasp reading https://make.wordpress.org/core/2016/07/08/multisite-focused-changes-in-4-6/ and both classes sources (and their related functions/other classes), WP_Site_Query queries about existing sites in a single network (e.g. find all active sites in that network) and WP_Network_Query do the same across several networks (e.g. find all archive blogs on all those networks).

| improve this answer | |
  • That makes sense. So where is the information on setting up multiple networks? I really want to see examples of queries you would run against each too. I know... I'm impatient with fresh releases. – jgraup Aug 24 '16 at 22:51
  • I guess for Multi Network you would need a plugin like wordpress.org/plugins/wp-multi-network – Celso Bessa Aug 26 '16 at 0:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.