Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

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;
}
Source by developer.wordpress.org #
 
PREVIOUS NEXT
Tagged: #wordpress #filter #category #widget
ADD COMMENT
Topic
Name
2+5 =