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

Retrieve category based on URL containing the category slug.


23 related functions found for: get_category_by_path

Top ↑

Related terms found for this post

TaxonomyTerms
wp-parser-related-wordscategori, categories, category, category-php, get, locat, location, path, taxonomi, taxonomy, wp-includes
wp-parser-packageTaxonomy, WordPress
wp-parser-source-filewp-includes/category.php

Top ↑

Terms Used Terms Used

Terms used in the related posts query

  • categori
  • categories
  • category
  • category-php
  • get
  • locat
  • location
  • path
  • taxonomi
  • taxonomy
  • Taxonomy
  • wp-includes
  • wp-includes/category.php

Top ↑

Description Description

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.


Top ↑

Parameters Parameters

$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. One of OBJECT, ARRAY_A, or ARRAY_N, which correspond to a WP_Term object, an associative array, or a numeric array, respectively.

Default value: OBJECT


Top ↑

Return Return

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


Top ↑

Source Source

File: wp-includes/category.php


			

Top ↑

Changelog Changelog

Changelog
Version Description
2.1.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.