函数原型
get_term_to_edit( int|object $id, string $taxonomy ): string|int|null|WP_Error
函数描述
Sanitizes term for editing.
是否弃用
未弃用
函数参数
-
$id
int|object
Required - Term ID or object.
-
$taxonomy
string
Required - Taxonomy name.
函数返回值
string|int|null|WP_Error Will return empty string if $term is not an object.
函数位置
File: wp-includes/taxonomy.php.
函数源码
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' );
}
源码链接
变更日志
| Version | Description |
|---|---|
| 2.3.0 | Introduced. |

