Hi,
if you have the Custom Fields extension https://wpadverts.com/extensions/custom-fields/ then while editing a Category field you should have there an option to show an empty option at the beginning of the list.
If you do not have this extension then you can insert the empty option using the adverts_form_load filter
add_filter( "adverts_form_load", "single_select_advert_category" );
function single_select_advert_category( $form ) {
if( $form['name'] != "advert" ) {
return $form;
}
foreach( $form["field"] as $key => $field ) {
if( $field["name"] == "advert_category" ) {
$form["field"][$key]["empty_option"] = true;
$form["field"][$key]["empty_option_text"] = "Select category ...";
$form["field"][$key]["max_choices"] = 1;
$form["field"][$key]["validator"] = array();
$form["field"][$key]["validator"][] = array(
"name" => "max_choices",
"params" => array( "max_choices" => 1 )
);
}
}
return $form;
}
The above code you can add in your theme functions.php file or even better create a new blank plugin (https://wpadverts.com/blog/how-to-use-code-snippets-in-wordpress/) and paste the code there.
Where do I find this, ive checked everywhere and cant find this option
“while editing a Category field you should have there an option to show an empty option at the beginning of the list.”