Q: Insert posting automatically based in acf field good day
I found a code that works, but it creates several posts of the same name, do not want that, he wanted to create only once post_type if the value is 'x', but he is creating a 'x' every time updates , how do I create it only once this post_type?

My Code: 
<?php 
    wp_insert_post( array(
        'post_status' => 'publish',
        'post_type' => 'fornecedores', // post_type which is created posting
        'post_title' => get_field('fornecedor'), // Custom field to generate the post type
        'post_content' => ''
    )
)
?>

Code is in a loop of the post type products.
Understand me?

A: Before inserting check if post exists:
$exists = get_page_by_title( get_field('fornecedor'), OBJECT, 'fornecedores');

if ( empty( $exists ) ) {
  wp_insert_post( array(
    'post_status' => 'publish',
    'post_type' => 'fornecedores', // post_type which is created posting
    'post_title' => get_field('fornecedor'), // Custom field to generate the post type
    'post_content' => ''
  )
}


A: *

*Create a post_type named "Products"

*Create a post_type named "Suppliers"

*In "Custom Fields", create a new field group and add a "rule" so
that it shows up on "Products"

*Then add a new field and select the "Relationship" field type

*Under "Post Type" for that field, choose "Suppliers"


Now on your Products posts, you can choose Suppliers.
Is... that what you are asking?
