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 |
---|---|
4067 |
|
4068 | /** |
4069 | * Filters the post statuses for updating the term count. |
4070 | * |
4071 | * @since 5.7.0 |
4072 | * |
4073 | * @param string[] $post_statuses List of post statuses to include in the count. Default is 'publish'. |
4074 | * @param WP_Taxonomy $taxonomy Current taxonomy object. |
4075 | */ |
4076 | $post_statuses = esc_sql( apply_filters( 'update_post_term_count_statuses', $post_statuses, $taxonomy ) ); |
4077 |
|
4078 | foreach ( (array) $terms as $term ) { |
4079 | $count = 0; |
4080 |
|
4081 | // Attachments can be 'inherit' status, we need to base count off the parent's status if so. |
4082 | if ( $check_attachments ) { |
4083 | // phpcs:ignore WordPress.DB.PreparedSQLPlaceholders.QuotedDynamicPlaceholderGeneration |
4084 | $count += (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_relationships, $wpdb->posts p1 WHERE p1.ID = $wpdb->term_relationships.object_id AND ( post_status IN ('" . implode( "', '", $post_statuses ) . "') OR ( post_status = 'inherit' AND post_parent > 0 AND ( SELECT post_status FROM $wpdb->posts WHERE ID = p1.post_parent ) IN ('" . implode( "', '", $post_statuses ) . "') ) ) AND post_type = 'attachment' AND term_taxonomy_id = %d", $term ) ); |
4085 | } |