ACF field for network post relations

Earlier today I needed to get posts across the entire WordPress Network installation into ACF post object field. To my surprise, this isn’t possible with ACF itself and few plugin implementations found from Github were abandoned or didn’t fit fully to my needs.

So what developer does in this kind of situation? Writes a plugin that adds a new field type.

Let me introduce: Network posts select field

I can’t make a simple thing to sound exciting. The field makes what it promises: let’s user to choose a post from any site in network installation.

On the field settings side of things, admin can filter the available posts by post type, taxonomy and site. In other words, admins can set from which sites in a network users can select content from.

Field returns always an array with site id and post id. It’s up to the developer to use those correctly in combination with switch_to_blog function.

The network posts select field is available as a plugin in Github.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.