Bazujące na WordPress narzędzie wyszukiwania dla deweloperów i twórców motywów.



get_term_to_edit ›

Od2.3.0
Przestarzałyn/a
get_term_to_edit ( $id, $taxonomy )
Parametry: (2)
  • (int|object) $id Term ID or object.
    Wymagane: Tak
  • (string) $taxonomy Taxonomy name.
    Wymagane: Tak
Powrót:
  • (string|int|null|WP_Error) Will return empty string if $term is not an object.
Zdefiniowane na:
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.



Źródło

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' );
}