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.
This hook occurs 3 times in this file.
Line | Code |
---|---|
157 | * @param string $separator Optional, default is empty string. Separator for between the categories. |
158 | * @param string $parents Optional. How to display the parents. |
159 | * @param int $post_id Optional. Post ID to retrieve categories. |
160 | * @return string |
161 | */ |
162 | function get_the_category_list( $separator = '', $parents='', $post_id = false ) { |
163 | global $wp_rewrite; |
164 | if ( ! is_object_in_taxonomy( get_post_type( $post_id ), 'category' ) ) { |
165 | /** This filter is documented in wp-includes/category-template.php */ |
166 | return apply_filters( 'the_category', '', $separator, $parents ); |
167 | } |
168 |
|
169 | $categories = get_the_category( $post_id ); |
170 | if ( empty( $categories ) ) { |
171 | /** This filter is documented in wp-includes/category-template.php */ |
172 | return apply_filters( 'the_category', __( 'Uncategorized' ), $separator, $parents ); |
173 | } |
174 |
|
175 | $rel = ( is_object( $wp_rewrite ) && $wp_rewrite->using_permalinks() ) ? 'rel="category tag"' : 'rel="category"'; |
176 |
|
177 | $thelist = ''; |
178 | if ( '' == $separator ) { |
179 | $thelist .= '<ul class="post-categories">'; |
180 | foreach ( $categories as $category ) { |
181 | $thelist .= "\n\t<li>"; |
Line | Code |
226 | * Filter the category or list of categories. |
227 | * |
228 | * @since 1.2.0 |
229 | * |
230 | * @param array $thelist List of categories for the current post. |
231 | * @param string $separator Separator used between the categories. |
232 | * @param string $parents How to display the category parents. Accepts 'multiple', |
233 | * 'single', or empty. |
234 | */ |
235 | return apply_filters( 'the_category', $thelist, $separator, $parents ); |
236 | } |
237 |
|
238 | /** |
239 | * Check if the current post in within any of the given categories. |
240 | * |
241 | * The given categories are checked against the post's categories' term_ids, names and slugs. |
242 | * Categories given as integers will only be checked against the post's categories' term_ids. |
243 | * |
244 | * Prior to v2.5 of WordPress, category names were not supported. |