Adds a ACF field that allows selecting posts across the network sites.
The field is very much silimar to native ACF Post Object one, with the exception that network posts select field will allow users to search posts across the entire network rather than just the site in which dashboard they are. On field settings it's possible to confugure a list of allowed sites in network from which the posts can be selected.
Because you don't do much with post ID or object if it's for wrong site in a network, the field returns always an array that contains site_id
and post_id
. Then you, as a developer, can use these ID's however you like.
It's highly suggested to use site filter if your network has tens of sites.
Field works, but search gets slower as the number of sites in network increases. This is something I might try to enhance in future. If your network has over 100 sites, field will try to get posts only from the first 100 sites. To change this, use acf/fields/network_post_select/settings/max_sites
filter to tell how many sites are shown in field options.
In case you like to live dangerously, there's also acf/fields/network_post_select/result
filter available where you can change arguments for get_sites
function used in posts search.
Changelog can be found from releases page and separate CHANGELOG.md file.
Code contributions, feedback, and feature suggestions are very welcome.