wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren



get_term_to_edit › WordPress Function

Seit2.3.0
Veraltetn/v
get_term_to_edit ( $id, $taxonomy )
Parameter: (2)
  • (int|object) $id Term ID or object.
    Erforderlich: Ja
  • (string) $taxonomy Taxonomy name.
    Erforderlich: Ja
Gibt zurück:
  • (string|int|null|WP_Error) Will return empty string if $term is not an object.
Definiert in:
Codex:

Sanitizes term for editing.

Return value is sanitize_term() and usage is for sanitizing the term for editing. Function is for contextual and simplicity.


Quellcode

function get_term_to_edit( $id, $taxonomy ) {
	$term = get_term( $id, $taxonomy );

	if ( is_wp_error( $term ) ) {
		return $term;
	}

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

	return sanitize_term( $term, $taxonomy, 'edit' );
}