WordPress 4.5 introduced to the world the WP_Site class. WordPress 4.6 is going to help you query sites in your network using the new WP_Site_Query class. What’s a site, really? WordPress has a neat feature called “WordPress Multisite” which allows you to create multiple sites with just a single installation. With multisite enabled, you can create multiple independent sites that are not connected to each other by any means, or, create a “network” of sites which are directly related to each other. If you really want to take WordPress to the extreme, you can create a network of networks, which is a multi-level network containing other networks and each of those has it’s own sites. A “site” is a single instance in the wp_blogs DB table. A “site” can simply be the website created by WordPress, or a virtual website created as part of a network by the multisite feature. Querying Sites As mentioned above, WordPress 4.5 introduced the WP_Site class which introduces interactivity options with a site on a multisite network. The class can be used for retrieving site data as well as for setting it up. As of WordPress 4.6, we can use the
Share This