Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: list_cats

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

This hook occurs 3 times in this file.

Line Code
420            * term name.
421            *
422            * @since 1.2.0
423            *
424            * @see wp_dropdown_categories()
425            *
426            * @param string       $element  Category name.
427            * @param WP_Term|null $category The category object, or null if there's no corresponding category.
428            */
429           $show_option_none = apply_filters( 'list_cats', $parsed_args['show_option_none'], null );
430           $output          .= "\t<option value='" . esc_attr( $option_none_value ) . "' selected='selected'>$show_option_none</option>\n";
431      }
432
433      if ( ! empty( $categories ) ) {
434
435           if ( $parsed_args['show_option_all'] ) {
436
437                /** This filter is documented in wp-includes/category-template.php */
438                $show_option_all = apply_filters( 'list_cats', $parsed_args['show_option_all'], null );
439                $selected        = ( '0' === (string) $parsed_args['selected'] ) ? " selected='selected'" : '';
440                $output         .= "\t<option value='0'$selected>$show_option_all</option>\n";
441           }
442
443           if ( $parsed_args['show_option_none'] ) {
444
445                /** This filter is documented in wp-includes/category-template.php */
446                $show_option_none = apply_filters( 'list_cats', $parsed_args['show_option_none'], null );
447                $selected         = selected( $option_none_value, $parsed_args['selected'], false );
448                $output          .= "\t<option value='" . esc_attr( $option_none_value ) . "'$selected>$show_option_none</option>\n";
449           }
450
451           if ( $parsed_args['hierarchical'] ) {
452                $depth = $parsed_args['depth'];  // Walk the full depth.
453           } else {
454                $depth = -1; // Flat.
455           }