get_term_to_edit

Definition:
function get_term_to_edit( $id, $taxonomy ) {}

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

Parameters

  • int|object $id: Term ID or Object
  • string $taxonomy: Taxonomy Name

Return values

returns:Will return empty string if $term is not an object.

Source code

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

}

1763

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: