首页 WordPress函数大全 get_category_by_path()

get_category_by_path()

2020-05-01 / 3766阅 / 悠然

如何你看完本文还不知道如何使用该函数,可以联系我定制视频教程,50元/个函数,学不会全额退款

get_category_by_path( string $category_path, bool $full_match = true, string $output = OBJECT )

Retrieve category based>

Contents

  • Description
    • Parameters
    • Return
    • Source
    • Changelog
  • Related
    • Uses
    • Used By
  • User Contributed Notes

描述

Breaks the $category_path parameter up to get the category slug.

Tries to find the child path and will return it. If it doesn’t find a match, then it will return the first category matching slug, if $full_match, is set to false. If it does not, then it will return null.

It is also possible that it will return a WP_Error object>

参数

$category_path

(string)
(Required)
URL containing category slugs.

$full_match

(bool)
(Optional)
Whether full path should be matched.

Default value: true

$output

(string)
(Optional)
The required return type.>WP_Term object, an associative array, or a numeric array, respectively.

Default value: OBJECT

返回

(WP_Term|array|WP_Error|null) Type is based on $output value.

大家谈论
    我的见解