get_category_by_path ( $category_path, $full_match = true, $output = OBJECT )
- (string) category_path URL containing category slugs.
- (bool) full_match Optional. Whether full path should be matched.
- (string) output Optional. The required return type. One of OBJECT, ARRAY_A, or ARRAY_N, which correspond to a WP_Term object, an associative array, or a numeric array, respectively. Default OBJECT.
- (WP_Term|array|WP_Error|null) Type is based on $output value.
- Introduced in WordPress: 2.1.0
- Deprecated in WordPress: —
Retrieve category based on URL containing the category slug.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 on failure. Check
for it when using this function.