get_term_to_edit()
最后更新于:2021-11-27 00:57:51
get_term_to_edit( int|object$id, string$taxonomy)Sanitizes Term for editing.
参数
- $id
-
(int|object) (Required) Term ID or object.
- $taxonomy
-
(string) (Required) Taxonomy name.
响应
(string|int|null|GC_Error) Will return empty string if $term is not an object.
源文件
文件: gc-includes/taxonomy.php
function get_term_to_edit( $id, $taxonomy ) {
$term = get_term( $id, $taxonomy );
if ( is_gc_error( $term ) ) {
return $term;
}
if ( ! is_object( $term ) ) {
return '';
}
return sanitize_term( $term, $taxonomy, 'edit' );
}