equal
deleted
inserted
replaced
147 } |
147 } |
148 |
148 |
149 foreach ( $categories as $category ) { |
149 foreach ( $categories as $category ) { |
150 $path = '/' . $leaf_path; |
150 $path = '/' . $leaf_path; |
151 $curcategory = $category; |
151 $curcategory = $category; |
152 while ( ( 0 != $curcategory->parent ) && ( $curcategory->parent != $curcategory->term_id ) ) { |
152 |
|
153 while ( ( 0 !== $curcategory->parent ) && ( $curcategory->parent !== $curcategory->term_id ) ) { |
153 $curcategory = get_term( $curcategory->parent, 'category' ); |
154 $curcategory = get_term( $curcategory->parent, 'category' ); |
154 |
155 |
155 if ( is_wp_error( $curcategory ) ) { |
156 if ( is_wp_error( $curcategory ) ) { |
156 return $curcategory; |
157 return $curcategory; |
157 } |
158 } |
158 |
159 |
159 $path = '/' . $curcategory->slug . $path; |
160 $path = '/' . $curcategory->slug . $path; |
160 } |
161 } |
161 |
162 |
162 if ( $path == $full_path ) { |
163 if ( $path === $full_path ) { |
163 $category = get_term( $category->term_id, 'category', $output ); |
164 $category = get_term( $category->term_id, 'category', $output ); |
164 _make_cat_compat( $category ); |
165 _make_cat_compat( $category ); |
165 |
166 |
166 return $category; |
167 return $category; |
167 } |
168 } |
267 * |
268 * |
268 * @param string $field Category key to sanitize. |
269 * @param string $field Category key to sanitize. |
269 * @param mixed $value Category value to sanitize. |
270 * @param mixed $value Category value to sanitize. |
270 * @param int $cat_id Category ID. |
271 * @param int $cat_id Category ID. |
271 * @param string $context What filter to use, 'raw', 'display', etc. |
272 * @param string $context What filter to use, 'raw', 'display', etc. |
272 * @return mixed Same type as $value after $value has been sanitized. |
273 * @return mixed Value after $value has been sanitized. |
273 */ |
274 */ |
274 function sanitize_category_field( $field, $value, $cat_id, $context ) { |
275 function sanitize_category_field( $field, $value, $cat_id, $context ) { |
275 return sanitize_term_field( $field, $value, $cat_id, 'category', $context ); |
276 return sanitize_term_field( $field, $value, $cat_id, 'category', $context ); |
276 } |
277 } |
277 |
278 |
304 * |
305 * |
305 * @since 2.3.0 |
306 * @since 2.3.0 |
306 * |
307 * |
307 * @param WP_Term[]|int|WP_Error $tags Array of 'post_tag' term objects, a count thereof, |
308 * @param WP_Term[]|int|WP_Error $tags Array of 'post_tag' term objects, a count thereof, |
308 * or WP_Error if any of the taxonomies do not exist. |
309 * or WP_Error if any of the taxonomies do not exist. |
309 * @param array $args An array of arguments. @see get_terms() |
310 * @param array $args An array of arguments. See {@see get_terms()}. |
310 */ |
311 */ |
311 $tags = apply_filters( 'get_tags', $tags, $args ); |
312 $tags = apply_filters( 'get_tags', $tags, $args ); |
312 } |
313 } |
313 |
314 |
314 return $tags; |
315 return $tags; |