Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




get_term_field [ WordPress Function ]

get_term_field ( $field, $term, $taxonomy, $context = 'display' )
Parameters:
  • (string) $field Term field to fetch
  • (int) $term Term ID
  • (string) $taxonomy Taxonomy Name
  • (string) $context Optional, default is display. Look at sanitize_term_field() for available options.
Uses:
Returns:
  • (mixed) Will return an empty string if $term is not an object or if $field is not set in $term.
Defined at:



Get sanitized Term field.

Does checks for $term, based on the $taxonomy. The function is for contextual reasons and for simplicity of usage. See sanitize_term_field() for more information.

Source


<?php
function get_term_field$field$term$taxonomy$context 'display' ) {
    
$term = (int) $term;
    
$term get_term$term$taxonomy );
    if ( 
is_wp_error($term) )
        return 
$term;

    if ( !
is_object($term) )
        return 
'';

    if ( !isset(
$term->$field) )
        return 
'';

    return 
sanitize_term_field($field$term->$field$term->term_id$taxonomy$context);
}
?>

Examples [ wp-snippets.com ]

Top Google zoekresultaten

Meer ...

Gebruikersdiscussies [ wordpress.org ]

0 User Note(s)

Nog geen één. Wees de eerste!

Nieuw toevoegen ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics