Creating connections programmatically with common fields on CPT’s

No need to code for this one as it was already solved by mikemanger with the plugin Batch Posts 2 Posts for, as the name says, batch creation of relations using Posts 2 Posts plugin framework.

As in their description:

This plugin makes it easy to create relations using the Posts 2 Posts
plugin.

For example you create a new “getting-started.pdf” post is your Downloads custom post type.
This plugin will let you assign this new post all posts in the “Getting started” post category.

The use cases are limited but it saves you (and your clients) from having to manually go into
and edit potentially hundreds of posts.

Thank you!