WPDev.one
Core Function
View Source on Trac ↗

get_category_by_path()

get_category_by_path( mixed $category_path, mixed $full_match = true, mixed $output = OBJECT )

Retrieves a category based on URL containing the category slug.

Parameters 2 required

Name / Type Description
$category_path
string

URL containing category slugs.

Required
$full_match
bool

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.

Required

Return Value

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

Function Information

Since Version
2.1.0
Source File
wp-includes/category.php
Advertisement