i made this
add_filter('wp_dropdown_cats', 'allow_empty_default_category', 10, 2);
function allow_empty_default_category($output, $parsed_args) {
var $empty_value = "";
var $empty_label = "-- NO DEFAULT --";
if ($parsed_args['name'] == "default_category") {
$output = str_replace("</select>", "<option value='{$empty_value}'>{$empty_label}</option></select>", $output);
}
return $output;
}arty updated it to this after critical error for using vars and not selecting no default option properly:
add_filter('wp_dropdown_cats', 'allow_empty_default_category', 10, 2);
function allow_empty_default_category($output, $parsed_args) {
$empty_value = "0";
$empty_label = "-- NO DEFAULT CATEGORY --";
if ($parsed_args['name'] == "default_category") {
$selected = ($parsed_args['selected'] == 0) ? " selected" : "";
$output = str_replace("</select>", "<option value='{$empty_value}'{$selected}>{$empty_label}</option></select>", $output);
}
return $output;
}