wpseek.com
WordPress开发者和主题制作者的搜索引擎



get_term_to_edit › WordPress Function

Since2.3.0
已弃用n/a
get_term_to_edit ( $id, $taxonomy )
参数: (2)
  • (int|object) $id Term ID or object.
    Required: Yes
  • (string) $taxonomy Taxonomy name.
    Required: Yes
返回:
  • (string|int|null|WP_Error) Will return empty string if $term is not an object.
定义在:
文档:

Sanitizes term for editing.

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


源码

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