Hi, you can make email field not required by adding code below to your theme functions.php
add_filter( "adverts_form_load", "customize_adverts_add" );
function customize_adverts_add( $form ) {
if( $form['name'] != "advert" ) {
return $form;
}
foreach( $form["field"] as $key => $field ) {
if( $field["name"] == "adverts_email" ) {
$field["validator"] = array( array( "name" => "is_email" ) );
}
}
return $form;
}
Note, that the plugin will most likely break if user will decide he wants to register an account but will not enter his email address.
This didn’t work unfortunately.
Tried adding it to Theme and Child Theme.
Still have the ‘Post updated, but cannot be published since some required data is not filled properly’ error.
Any other ideas? Thanks 🙂
There is one missing line in the code, try this instead
add_filter( "adverts_form_load", "customize_adverts_add" );
function customize_adverts_add( $form ) {
if( $form['name'] != "advert" ) {
return $form;
}
foreach( $form["field"] as $key => $field ) {
if( $field["name"] == "adverts_email" ) {
$field["validator"] = array( array( "name" => "is_email" ) );
$form["field"][$key] = $field;
}
}
return $form;
}