Post Selector Multisite

This feature adds multisite support to the featured content layout block and the child blocks used in it.
In order to properly display previews of the posts in other sites, the extension adds custom endpoints that are used to load sub-site specific postType and taxonomy entitites.

Last modified: May 23, 2025

Those entities have custom baseURL parameters that point to T2 endpoints in this extension that handle grabbing content from other subsites.

This allows the usage of core-data hooks like useEntityProp to load data from other subsites and if support for site id parameters are added to the core-data hooks the blocks will require minimal changes.

For each site in the network, new entities are registered with the site id appended to the post type key.

link Example:

the network has 3 sites - ids 1, 2, and 3.
With the extension active, entities will be loaded for each post type and each site.
If the post types used by the site are post and page entities will be registered as:

This is purely displaying the data properly in Gutenberg, the siteId is stored as an attribute in the block and inherited in the context of the child blocks and when server-side rendered switch_to_blog is used.

link Taxonomies

A similar approach, as described above, is used for taxonomies by appending the site id to the taxonomy key.

In the same example above we'd have:

As long as there is no taxonomy registered that has the same name, the data for those taxonomies will be loaded from the correct subsite.

link Query inspector

The Query inspector controls used for custom queries are also extended and if the multisite extension is enabled a "Site" selector will be added. This will be stored as a siteId attribute in the Featured Query Post block or the Featured Content Layout block and used to query from the correct subsite.

link Limitations

In the current version, due to the way post types are registered in WordPress all post types that are used across sites must be registered across all sites. This means that if you are using a plugin that adds a custom post type (for example, WooCommerce), that plugin needs to be active across the whole network or at least on the sites where you want to display blocks from that post type.

link Enabling

By default, the multisite support is not enabled. To enable it, add the following to your t2.json file:

"t2/featured-single-post": {
	"__experimentalAllowMultisitePosts": true,
	"__experimentalAllowedMultisitePostSites": [1,2]
},
"t2/featured-query-post": {
	"__experimentalAllowMultisitePosts": true,
	"__experimentalAllowedMultisitePostSites": [1,2]
}
"t2/featured-content-layout": {
	"__experimentalAllowMultisitePosts": true,
	"__experimentalAllowedMultisitePostSites": [1,2]
}

If you want to allow all sites in the network to be selected, you can do so by adding the following to your t2.json file:

"t2/featured-query-post": {
	"__experimentalAllowMultisitePosts": true,
	"__experimentalAllowedMultisitePostSites": ['all']
}

link Filters

link Post type entities

Filter: t2/editor/post_selector/multisite/types_response

Filters the post types response used to add entities for post types specific to the multisite network.

link Post response

Filter: t2/editor/post_selector/multisite/post_response

This allows you to modify the output used in the posts loaded by the custom postType entities.

link Taxonomy entities

Filter: t2/editor/post_selector/multisite/taxonomies_response

Allows you to filter the response for the taxonomies added as custom entities.

link Taxonomy response

Filter: t2/editor/post_selector/multisite/taxonomy_response

Allows you to modify the output used in the taxonomies loaded by the custom taxonomy entities.