get_category_parents
函数
get_category_parents ( $category_id, $link = false, $separator = '/', $nicename = false, $deprecated = array() )
- 参数
-
-
(int)
$category_id
Category ID.- Required: 是
-
(bool)
$link
Optional. Whether to format with link. Default false.- Required: 否
- Default: false
-
(string)
$separator
Optional. How to separate categories. Default ‘/’.- Required: 否
- Default: ‘/’
-
(bool)
$nicename
Optional. Whether to use nice name for display. Default false.- Required: 否
- Default: false
-
(array)
$deprecated
Not used.- Required: 否
- Default: array()
-
(int)
- 返回值
-
- (string|WP_Error) A list of category parents on success, WP_Error on failure.
- 定义位置
-
-
wp-includes/category-template.php
, line 47
-
wp-includes/category-template.php
- 引入
- 1.2.0
- 弃用
- –
Retrieves category parents with separator.
function get_category_parents( $category_id, $link = false, $separator = '/', $nicename = false, $deprecated = array() ) { if ( ! empty( $deprecated ) ) { _deprecated_argument( __FUNCTION__, '4.8.0' ); } $format = $nicename ? 'slug' : 'name'; $args = array( 'separator' => $separator, 'link' => $link, 'format' => $format, ); return get_term_parents_list( $category_id, 'category', $args ); }
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。