WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )apply_filters( "hook_name", "what_to_filter" ).Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
| Line | Code |
|---|---|
| 673 | } |
| 674 | |
| 675 | extract($args, EXTR_SKIP); |
| 676 | $output = ''; |
| 677 | $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Recent Comments' ) : $instance['title'], $instance, $this->id_base ); |
| 678 | |
| 679 | if ( empty( $instance['number'] ) || ! $number = absint( $instance['number'] ) ) |
| 680 | $number = 5; |
| 681 | |
| 682 | $comments = get_comments( apply_filters( 'widget_comments_args', array( 'number' => $number, 'status' => 'approve', 'post_status' => 'publish' ) ) ); |
| 683 | $output .= $before_widget; |
| 684 | if ( $title ) |
| 685 | $output .= $before_title . $title . $after_title; |
| 686 | |
| 687 | $output .= '<ul id="recentcomments">'; |
| 688 | if ( $comments ) { |
| 689 | // Prime cache for associated posts. (Prime post term cache if we need it for permalinks.) |
| 690 | $post_ids = array_unique( wp_list_pluck( $comments, 'comment_post_ID' ) ); |
| 691 | _prime_post_caches( $post_ids, strpos( get_option( 'permalink_structure' ), '%category%' ), false ); |