get_term_to_edit() - WordPress 函数参考中文文档

返回介绍

get_term_to_edit()

发布于 2017-09-11 字数1472 浏览 1064 评论 0

get_term_to_edit( int|object $id,  string $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.


参数

$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 描述
2.3.0 Introduced.

相关函数

Uses

  • wp-includes/taxonomy.php:
    sanitize_term()
  • wp-includes/taxonomy.php:
    get_term()
  • wp-includes/load.php:
    is_wp_error()

User Contributed Notes

上一篇:get_term_parents_list()

下一篇:get_theme()

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

目前还没有任何评论,快来抢沙发吧!