Changeset 35028
- Timestamp:
- 10/12/2015 04:13:25 AM (9 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/taxonomy-functions.php
r34999 r35028 921 921 * Get sanitized Term field. 922 922 * 923 * Does checks for $term, based on the $taxonomy. The function is for contextual 924 * reasons and for simplicity of usage. See sanitize_term_field() for more 925 * information. 923 * The function is for contextual reasons and for simplicity of usage. 926 924 * 927 925 * @since 2.3.0 928 * 929 * @param string $field Term field to fetch. 930 * @param int $term Term ID. 931 * @param string $taxonomy Taxonomy Name. 926 * @since 4.4.0 The `$taxonomy` parameter was made optional. `$term` can also now accept a WP_Term object. 927 * 928 * @see sanitize_term_field() 929 * 930 * @param string $field Term field to fetch. 931 * @param int|WP_Term $term Term ID or object. 932 * @param string $taxonomy Optional. Taxonomy Name. Default empty. 932 933 * @param string $context Optional, default is display. Look at sanitize_term_field() for available options. 933 934 * @return string|int|null|WP_Error Will return an empty string if $term is not an object or if $field is not set in $term. 934 935 */ 935 function get_term_field( $field, $term, $taxonomy, $context = 'display' ) { 936 $term = (int) $term; 936 function get_term_field( $field, $term, $taxonomy = '', $context = 'display' ) { 937 937 $term = get_term( $term, $taxonomy ); 938 938 if ( is_wp_error($term) ) … … 945 945 return ''; 946 946 947 return sanitize_term_field( $field, $term->$field, $term->term_id, $taxonomy, $context);947 return sanitize_term_field( $field, $term->$field, $term->term_id, $term->taxonomy, $context ); 948 948 } 949 949
Note: See TracChangeset
for help on using the changeset viewer.