如何设置"选择类别"到非0的值


wordpress : How to set the value of "Select Category" to a value other than 0

基本上我显示了一个特定类别的子类别的下拉菜单,现在我想如果没有人选择一个子类别并单击搜索,那么默认情况下它只从父类别搜索。我添加了this

 'show_option_all' => __( 'All Manufacturers', APP_TD ),

,但它的默认值是"0",我想把它的值从"0"改为187。有什么帮助吗?这里我要实现

你可以像下面这样做;

$args = array( 
    'show_option_all' => __( 'All Manufacturers', APP_TD ),
    ..............
    );
$str = wp_list_categories($args);
// or use this
// $str = str_replace('value="0"', 'value="187"', $str);
$str = str_replace("value='0'", "value='187'", $str);