Try this function
wp_get_post_categories()
Check more reference from here: https://developer.wordpress.org/reference/functions/wp_get_post_categories/
Related Posts:
- How to add the category ID to admin page
- Add category to custom post type automatically, using category slug
- On Category page, How can I get the category ID?
- How to get category URL with the slug?
- How to view WordPress’ default category IDs?
- Style category link depending on category ID
- Edit tag_id in category pages of dashboard
- How to get selected taxonomy or category ID if using custom walker?
- Check is category parent with ids from the childs – get_term_children
- How to define category ID in an array?
- Control term order on a per-post basis
- Display all posts from all categories with pagination
- is_category() function
- Changing Top Level Items into Radio Buttons in the Categories Meta Box?
- How to create a widgetized sidebar for every category dynamically?
- Remove “Category Archives: title” at the top of a category page [duplicate]
- When using get_categories or similar, is it possible to filter results that contain certain Tags as well?
- Category Alphabet List Broken
- WooCommerce – Display product child categories from specific parent
- Display only one result from “get_the_category_list”
- Display empty taxonomy terms with get_terms()
- Show list of categories even if they have no posts
- Assign an icon to a category post
- How can I show the subcategories content on the parent category page?
- How to control template resolution if both Author and Category filter in place?
- Resolved – category-slug.php not working after wordpress migration
- How to retain the values from dropdown category lists after wrong form submission?
- Category archive page – loop through posts of certain tag (with pagination) – pre_get_posts
- Format Brand value in Category view [closed]
- Get multidimensional array that reflects category hierarchy
- Add Post Screen Keep Category structure
- 3 Columns, 3 Categories, One Archive, and Pagination
- Possible to make a subdirectory that loops through a single category?
- editing fonts of category links from the_category() funtion
- Archives for each category on WP Multisite
- Update post title with category name after editing a category
- Automatically set default password to all posts in a specific category
- Style wp_list_categories
- Warn me about ‘uncategorized’ posts
- Categories showing page not found
- Why category.php throw 404 in wordpress while calling paginate_links()?
- How to get related tags based on a category?
- Send to different single pages by category when multiple categories exist
- How to get latest posts from each category in regular order
- How can you change the permalink for pages?
- Pagination for ajax category filter
- Get posts from specific taxonomy term
- limit a list of tags to one category [closed]
- WordPress Drop down category as array for using in page builder
- Get sort order of product categories
- How to select category on if function
- how to wordpress When I click on the category link, subcategories appear
- Problem with different query loops (and “main loop”) on category template page!
- Show posts in “image” format when viewed in category page, but with comments in blog
- Change the name Category – Not change category name
- How to change the order of the subcategory and category in a post?
- Properly setting up a feed
- Display posts of certain categories to specific user roles
- Display Related Posts by “Category” “by Author”
- Change post title if post has specific category
- How to schedule categories?
- Template for product-category page [closed]
- How set all posts in wordpress in one category
- Copy post taxonomy?
- custom query for both category and pages using global $wpdb;
- How to get sub-categories to display same look as there parents
- Combining these queries? (Same taxonomy term + same category as post)
- get_object_term_cache duplicate terms after update to wordpress 6
- WordPress PageNavi Plugin not working in category.php
- Different post slug based on archive
- How do I get conditional sidebars for specific category archives and posts
- Post does not show category wish just show latest post
- Sidebar by Category Conditional Statement not functioning
- Style post archive blog preview based on category
- Woocommerce Category Sort Dropdown
- Loop by category and meta_key
- Is there a way to ‘archive’ inactive categories?
- Hiding by default posts in given category except for some cases
- create post with main category and other categories from admin panel
- How Can Hide Define Category in Post Contents?
- How to auto update post title and slug with category name when post status is updated
- get_posts – require all categories
- 404 error when i try to search by category or by tag
- Choosing different templates for categories
- Problem with wp_list_categories
- hierarchical taxonomy in permalinks? using same slug
- Display one post on category.php: Wrong featured image
- WordPress Numeric Pagination with Query String [duplicate]
- Changing Permalinks for Category Pages Only
- Taxonomy for custom post type not found
- Get post by Category in custom template
- Ajax call activate after submit in edit-tags.php page
- How can I get this code to only output one link?
- Assign a category by user and customize the edit-tags.php?taxonomy=category page
- comments_number fails to print
- Sorting Woocommerce products by category and attributes
- How to get Woocomerce categories count
- How to show child category name & post from it’s parent [closed]
- Open everything in new tab
- how do I exclude a category foreach