Changeset 53715 for trunk/src/wp-includes/category-template.php
- Timestamp:
- 07/18/2022 05:35:51 PM (4 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/category-template.php (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/category-template.php
r53543 r53715 91 91 * 92 92 * @since 3.1.0 93 * @since 4.4.0 Added `$post_id` parameter.93 * @since 4.4.0 Added the `$post_id` parameter. 94 94 * 95 95 * @param WP_Term[] $categories An array of categories to return for the post. 96 * @param int|false $post_id ID of the post.96 * @param int|false $post_id The post ID. 97 97 */ 98 98 return apply_filters( 'get_the_categories', $categories, $post_id ); … … 134 134 * @param string $separator Optional. Separator between the categories. By default, the links are placed 135 135 * in an unordered list. An empty string will result in the default behavior. 136 * @param string $parents Optional. How to display the parents. 137 * @param int $post_id Optional. Post ID to retrieve categories. 136 * @param string $parents Optional. How to display the parents. Accepts 'multiple', 'single', or empty. 137 * Default empty string. 138 * @param int $post_id Optional. ID of the post to retrieve categories for. Defaults to the current post. 138 139 * @return string Category list for a post. 139 140 */ … … 152 153 * 153 154 * @param WP_Term[] $categories An array of the post's categories. 154 * @param int| bool $post_id ID of the post we're retrievingcategories for.155 * When `false`, we assumethe current post in the loop.155 * @param int|false $post_id ID of the post to retrieve categories for. 156 * When `false`, defaults to the current post in the loop. 156 157 */ 157 158 $categories = apply_filters( 'the_category_list', get_the_category( $post_id ), $post_id ); … … 251 252 * @param int|string|int[]|string[] $category Category ID, name, slug, or array of such 252 253 * to check against. 253 * @param int| object $post Optional. Post to check instead ofthe current post.254 * @param int|WP_Post $post Optional. Post to check. Defaults to the current post. 254 255 * @return bool True if the current post is in any of the given categories. 255 256 */ … … 269 270 * @param string $separator Optional. Separator between the categories. By default, the links are placed 270 271 * in an unordered list. An empty string will result in the default behavior. 271 * @param string $parents Optional. How to display the parents. 272 * @param int $post_id Optional. Post ID to retrieve categories. 272 * @param string $parents Optional. How to display the parents. Accepts 'multiple', 'single', or empty. 273 * Default empty string. 274 * @param int $post_id Optional. ID of the post to retrieve categories for. Defaults to the current post. 273 275 */ 274 276 function the_category( $separator = '', $parents = '', $post_id = false ) { … … 1162 1164 * @since 2.3.0 1163 1165 * 1164 * @param int|WP_Post $post _idPost ID or object.1166 * @param int|WP_Post $post Post ID or object. 1165 1167 * @return WP_Term[]|false|WP_Error Array of WP_Term objects on success, false if there are no terms 1166 1168 * or the post does not exist, WP_Error on failure. 1167 1169 */ 1168 function get_the_tags( $post _id= 0 ) {1169 $terms = get_the_terms( $post _id, 'post_tag' );1170 function get_the_tags( $post = 0 ) { 1171 $terms = get_the_terms( $post, 'post_tag' ); 1170 1172 1171 1173 /** … … 1279 1281 function get_the_terms( $post, $taxonomy ) { 1280 1282 $post = get_post( $post ); 1283 1281 1284 if ( ! $post ) { 1282 1285 return false; … … 1284 1287 1285 1288 $terms = get_object_term_cache( $post->ID, $taxonomy ); 1289 1286 1290 if ( false === $terms ) { 1287 1291 $terms = wp_get_object_terms( $post->ID, $taxonomy ); … … 1477 1481 * @param string|int|array $category Optional. The category name/term_id/slug, 1478 1482 * or an array of them to check for. Default empty. 1479 * @param int| object $post Optional. Post to check instead ofthe current post.1483 * @param int|WP_Post $post Optional. Post to check. Defaults to the current post. 1480 1484 * @return bool True if the current post has any of the given categories 1481 1485 * (or any category, if no category specified). False otherwise. … … 1504 1508 * @param string|int|array $tag Optional. The tag name/term_id/slug, 1505 1509 * or an array of them to check for. Default empty. 1506 * @param int| object $post Optional. Post to check instead ofthe current post.1510 * @param int|WP_Post $post Optional. Post to check. Defaults to the current post. 1507 1511 * @return bool True if the current post has any of the given tags 1508 1512 * (or any tag, if no tag specified). False otherwise. … … 1525 1529 * or an array of them to check for. Default empty. 1526 1530 * @param string $taxonomy Optional. Taxonomy name. Default empty. 1527 * @param int|WP_Post $post Optional. Post to check instead ofthe current post.1531 * @param int|WP_Post $post Optional. Post to check. Defaults to the current post. 1528 1532 * @return bool True if the current post has any of the given terms 1529 1533 * (or any term, if no term specified). False otherwise.
Note: See TracChangeset
for help on using the changeset viewer.