Answers for "wordpress filter category from widget"

PHP
0

wordpress filter category from widget

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;
}
Posted by: Guest on October-07-2021

Code answers related to "wordpress filter category from widget"

Browse Popular Code Answers by Language