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?