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 |
|---|---|
| 8222 | */ |
| 8223 | function _update_term_count_on_transition_post_status( $new_status, $old_status, $post ) { |
| 8224 | if ( $new_status === $old_status ) { |
| 8225 | return; |
| 8226 | } |
| 8227 | |
| 8228 | // Update counts for the post's terms. |
| 8229 | foreach ( (array) get_object_taxonomies( $post->post_type, 'objects' ) as $taxonomy ) { |
| 8230 | /** This filter is documented in wp-includes/taxonomy.php */ |
| 8231 | $counted_statuses = apply_filters( 'update_post_term_count_statuses', array( 'publish' ), $taxonomy ); |
| 8232 | |
| 8233 | /* |
| 8234 | * Do not recalculate term count if both the old and new status are not included in term counts. |
| 8235 | * This accounts for a transition such as draft -> pending. |
| 8236 | */ |
| 8237 | if ( ! in_array( $old_status, $counted_statuses, true ) && ! in_array( $new_status, $counted_statuses, true ) ) { |
| 8238 | continue; |
| 8239 | } |
| 8240 | |