I want to check values of meta-key
called cf_isbn
already in database in table wp-postmeta
. If value is repeated, prevent insert content.
I have piece of code, that works correctly if I put xxxxxxx
value to my ISBN field in frontend post-input, but the main point is change xxxxxxx
with query to check values already exist in database.
Is there any php wizard who know how to help me?
function wpufe_isbn_validation( $errors ) {
if( $_POST['cf_isbn'] == 'xxxxxxx' ) {
$errors[] = 'this ISBN is already in database';
}
return $errors;
}
add_filter( 'wpuf_add_post_validation', 'wpufe_isbn_validation' );