thanks for fast reply.
can you assist me to achieve it.
i tried the below code:
function restrict_one_post_per_phone_number($post_id, $form_id, $form_settings, $form_vars) {
$phone_number = isset($_POST['meta key']) ? sanitize_text_field($_POST['meta key']) : '';
if (empty($phone_number)) {
return;
}
$existing_posts = new WP_Query(array(
'post_type' => 'post',
'meta_query' => array(
array(
'key' => '__________',
'value' => $phone_number,
'compare' => '='
)
)
));
/
if ($existing_posts->have_posts()) {
wp_delete_post($post_id, true);
wp_die('A post with this phone number already exists. You cannot submit more than one post with the same phone number.', 'Error', array('back_link' => true));
}
}
add_action(‘wpuf_form_post_submitted’, ‘restrict_one_post_per_phone_number’, 10, 4);