📅  最后修改于: 2022-03-11 14:54:22.327000             🧑  作者: Mango
add_filter( 'widget_categories_args', 'widget_categories_args_filter', 10, 1 );
function widget_categories_args_filter( $cat_args ) {
$exclude_arr = array( 4 );
if( isset( $cat_args['exclude'] ) && !empty( $cat_args['exclude'] ) )
$exclude_arr = array_unique( array_merge( explode( ',', $cat_args['exclude'] ), $exclude_arr ) );
$cat_args['exclude'] = implode( ',', $exclude_arr );
return $cat_args;
}