Changeset 48622
- Timestamp:
- 07/26/2020 04:05:39 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/category-template.php
r48586 r48622 38 38 * @since 4.8.0 The `$visited` parameter was deprecated and renamed to `$deprecated`. 39 39 * 40 * @param int $ idCategory ID.41 * @param bool $link Optional. Whether to format with link. Default false.42 * @param string $separator Optional. How to separate categories. Default '/'.43 * @param bool $nicename Optional. Whether to use nice name for display. Default false.44 * @param array $deprecated Not used.40 * @param int $category_id Category ID. 41 * @param bool $link Optional. Whether to format with link. Default false. 42 * @param string $separator Optional. How to separate categories. Default '/'. 43 * @param bool $nicename Optional. Whether to use nice name for display. Default false. 44 * @param array $deprecated Not used. 45 45 * @return string|WP_Error A list of category parents on success, WP_Error on failure. 46 46 */ 47 function get_category_parents( $ id, $link = false, $separator = '/', $nicename = false, $deprecated = array() ) {47 function get_category_parents( $category_id, $link = false, $separator = '/', $nicename = false, $deprecated = array() ) { 48 48 49 49 if ( ! empty( $deprecated ) ) { … … 59 59 ); 60 60 61 return get_term_parents_list( $ id, 'category', $args );61 return get_term_parents_list( $category_id, 'category', $args ); 62 62 } 63 63 … … 72 72 * @since 0.71 73 73 * 74 * @param int $ id Optional. The post ID. Defaults to current post ID.74 * @param int $post_id Optional. The post ID. Defaults to current post ID. 75 75 * @return WP_Term[] Array of WP_Term objects, one for each category assigned to the post. 76 76 */ 77 function get_the_category( $ id = false ) {78 $categories = get_the_terms( $ id, 'category' );77 function get_the_category( $post_id = false ) { 78 $categories = get_the_terms( $post_id, 'category' ); 79 79 if ( ! $categories || is_wp_error( $categories ) ) { 80 80 $categories = array(); … … 91 91 * 92 92 * @since 3.1.0 93 * @since 4.4.0 Added `$ id` parameter.93 * @since 4.4.0 Added `$post_id` parameter. 94 94 * 95 95 * @param WP_Term[] $categories An array of categories to return for the post. 96 * @param int|false $ idID of the post.96 * @param int|false $post_id ID of the post. 97 97 */ 98 return apply_filters( 'get_the_categories', $categories, $ id );98 return apply_filters( 'get_the_categories', $categories, $post_id ); 99 99 } 100 100 … … 133 133 function get_the_category_list( $separator = '', $parents = '', $post_id = false ) { 134 134 global $wp_rewrite; 135 135 136 if ( ! is_object_in_taxonomy( get_post_type( $post_id ), 'category' ) ) { 136 137 /** This filter is documented in wp-includes/category-template.php */ … … 1141 1142 * @since 2.3.0 1142 1143 * 1143 * @param int $ id Post ID.1144 * @param int $post_id Post ID. 1144 1145 * @return array|false|WP_Error Array of tag objects on success, false on failure. 1145 1146 */ 1146 function get_the_tags( $id = 0 ) { 1147 function get_the_tags( $post_id = 0 ) { 1148 $terms = get_the_terms( $post_id, 'post_tag' ); 1147 1149 1148 1150 /** … … 1155 1157 * @param WP_Term[] $terms An array of tags for the given post. 1156 1158 */ 1157 return apply_filters( 'get_the_tags', get_the_terms( $id, 'post_tag' ));1159 return apply_filters( 'get_the_tags', $terms ); 1158 1160 } 1159 1161 … … 1163 1165 * @since 2.3.0 1164 1166 * 1165 * @param string $before Optional. String to use before tags.1166 * @param string $sep Optional. String to use between the tags.1167 * @param string $after Optional. String to use after tags.1168 * @param int $ idOptional. Post ID. Defaults to the current post.1167 * @param string $before Optional. String to use before tags. 1168 * @param string $sep Optional. String to use between the tags. 1169 * @param string $after Optional. String to use after tags. 1170 * @param int $post_id Optional. Post ID. Defaults to the current post. 1169 1171 * @return string|false|WP_Error A list of tags on success, false if there are no terms, WP_Error on failure. 1170 1172 */ 1171 function get_the_tag_list( $before = '', $sep = '', $after = '', $id = 0 ) { 1173 function get_the_tag_list( $before = '', $sep = '', $after = '', $post_id = 0 ) { 1174 $tag_list = get_the_term_list( $post_id, 'post_tag', $before, $sep, $after ); 1172 1175 1173 1176 /** … … 1180 1183 * @param string $sep String to use between the tags. 1181 1184 * @param string $after String to use after tags. 1182 * @param int $ idPost ID.1185 * @param int $post_id Post ID. 1183 1186 */ 1184 return apply_filters( 'the_tags', get_the_term_list( $id, 'post_tag', $before, $sep, $after ), $before, $sep, $after, $id );1187 return apply_filters( 'the_tags', $tag_list, $before, $sep, $after, $post_id ); 1185 1188 } 1186 1189 … … 1287 1290 * @since 2.5.0 1288 1291 * 1289 * @param int $ idPost ID.1292 * @param int $post_id Post ID. 1290 1293 * @param string $taxonomy Taxonomy name. 1291 1294 * @param string $before Optional. Before list. … … 1294 1297 * @return string|false|WP_Error A list of terms on success, false if there are no terms, WP_Error on failure. 1295 1298 */ 1296 function get_the_term_list( $ id, $taxonomy, $before = '', $sep = '', $after = '' ) {1297 $terms = get_the_terms( $ id, $taxonomy );1299 function get_the_term_list( $post_id, $taxonomy, $before = '', $sep = '', $after = '' ) { 1300 $terms = get_the_terms( $post_id, $taxonomy ); 1298 1301 1299 1302 if ( is_wp_error( $terms ) ) { … … 1400 1403 * @since 2.5.0 1401 1404 * 1402 * @param int $ idPost ID.1405 * @param int $post_id Post ID. 1403 1406 * @param string $taxonomy Taxonomy name. 1404 1407 * @param string $before Optional. Before list. … … 1407 1410 * @return void|false Void on success, false on failure. 1408 1411 */ 1409 function the_terms( $ id, $taxonomy, $before = '', $sep = ', ', $after = '' ) {1410 $term_list = get_the_term_list( $ id, $taxonomy, $before, $sep, $after );1412 function the_terms( $post_id, $taxonomy, $before = '', $sep = ', ', $after = '' ) { 1413 $term_list = get_the_term_list( $post_id, $taxonomy, $before, $sep, $after ); 1411 1414 1412 1415 if ( is_wp_error( $term_list ) ) {
Note: See TracChangeset
for help on using the changeset viewer.