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 |
---|---|
678 | extract($args, EXTR_SKIP); |
679 | $output = ''; |
680 |
|
681 | $title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : __( 'Recent Comments' ); |
682 | $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); |
683 | $number = ( ! empty( $instance['number'] ) ) ? absint( $instance['number'] ) : 5; |
684 | if ( ! $number ) |
685 | $number = 5; |
686 |
|
687 | $comments = get_comments( apply_filters( 'widget_comments_args', array( 'number' => $number, 'status' => 'approve', 'post_status' => 'publish' ) ) ); |
688 | $output .= $before_widget; |
689 | if ( $title ) |
690 | $output .= $before_title . $title . $after_title; |
691 |
|
692 | $output .= '<ul id="recentcomments">'; |
693 | if ( $comments ) { |
694 | // Prime cache for associated posts. (Prime post term cache if we need it for permalinks.) |
695 | $post_ids = array_unique( wp_list_pluck( $comments, 'comment_post_ID' ) ); |
696 | _prime_post_caches( $post_ids, strpos( get_option( 'permalink_structure' ), '%category%' ), false ); |