has_category( string|int|array $category = '', int|object $post = null )

Check if the current post has any of given category.

25 related functions found for: has_category

Top ↑

Related terms found for this post

wp-parser-related-wordscategori, categories, category, category-template-php, exist, ha, has, taxonomi, taxonomy, wp-includes
wp-parser-packageTemplate, WordPress

Top ↑

Terms Used Terms Used

Terms used in the related posts query

  • categori
  • categories
  • category
  • category-template-php
  • exist
  • ha
  • has
  • taxonomi
  • taxonomy
  • Template
  • wp-includes
  • wp-includes/category-template.php
  • template

Top ↑

Description Description

Top ↑

Parameters Parameters


(string|int|array) (Optional) The category name/term_id/slug or array of them to check for.

Default value: ''


(int|object) (Optional) Post to check instead of the current post.

Default value: null

Top ↑

Return Return

(bool) True if the current post has any of the given categories (or any category, if no category specified).

Top ↑

Source Source

File: wp-includes/category-template.php


Top ↑

Changelog Changelog

Version Description
3.1.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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