*get_the_category();* is designed to return multiple categories. You have to provide index for deciding which categories’ nicename you want to echo.
Something like below,
$category = get_the_category();
echo '<img src="'.get_bloginfo('template_directory').'/images/categories/'.$category[0]->category_nicename.'.png">';
Related Posts:
- How do I get the category URL from get_the_category?
- How do I use the same post slug for different Categories?
- Rewrite rule page url with category
- Create terms when registering taxonomy?
- How to create non-unique sub-category slugs?
- Rewrite category slug
- Using same slug name for a page and category
- Add category to custom post type automatically, using category slug
- I use same slug name for category and page
- Divi change project slug based on category
- Removing the number in a category slug
- Add custom taxonomy terms to WordPress menu dynamically & append #slug to url
- Plural Category Base Slug On Category Archive Page
- Return category slug / title from category ID
- Duplicate Category and Page URL loads Category instead of the Page
- Category slug $_SERVER[‘REQUEST_URI’];
- 403 forbidden on one page only
- Get the name an the description of a link category
- Using a portfolio_category slug in wordpress URL
- Categories vs. Page Site Organization
- WooCommerce duplicate sub categories and product slugs
- Need to pull parent category and slug – only pulling daughter category
- Pagination for category slug returns 404 when page >= 2
- Displaying a full post instead of a slug per category?
- wordpress sub-category ( lowercase letters + non-latin characters ) = 404
- The default code for “posts_nav_link” on category.php isn’t working
- Mod_Rewrite to show only last subcategory in URL
- Get posts from specific taxonomy term
- how to get full category path including parent and subcategories
- Automatically redirect a page to a category that share the same slug
- Use the category name instead of category slug in permalinks
- How do I add a tag slug to a category URL to filter posts?
- Change of category structure will cause two kinds of URLs for one post
- Change slug of Standard wp Post category
- How to remove the category from post slug
- Ordering categories by slug vs. name
- pagination 404 error, same slug home and categories
- Different post slug based on archive
- A different permalink structure for different categories
- OK to redirect the root WordPress category slug?
- How Can I Use Equal And Question Mark In Category Slug?
- How to remove category name for only one category?
- How to prevent WordPress from redirecting single page to prefixed category archive with same name?
- Include a page’s “category” in its URL
- Using the slug of a custom post category as prefix for the underlying custom post slugs
- Change the full slug for a specific category?
- Get category from slug list
- How to auto update post title and slug with category name when post status is updated
- Hide category name using mod_rewrite
- Show only one of the categories of a post in the breadcrumb?
- hierarchical taxonomy in permalinks? using same slug
- woocommerce – products by category slug? [closed]
- Category slug in in loop always the same?
- How can I get rid of the the category suffix–NOT “prefix” (i.e. foo-1, foo-2, etc)
- How to get category slug link? ( include parent categories)
- How to add custom prefix before category base for category page URL?
- Get all categories and posts in those categories
- How to display non-hierarchical taxonomy as terms with checkboxes?
- Combine two taxonomies in a hierarchical tree
- Get the number of posts in a named category, outside the loop
- Test if post has a category
- I want to order categories based upon the latest post time
- Highlight current category in wp_list_categories
- How to find all posts without category and assign the “Uncategorized”?
- How to Override default update_count_callback for category
- WordPress previous_post_link exclude posts with multiple categories
- Is it possible to put tags and category information in the post as text?
- Is it possible to post with Word 2007 via XML-RPC and limit categories by user?
- how to get the categories for a single post in a hierarchical way
- Is there a cleaner way to get post count for a category in category.php?
- How to make the link to the category for a post go to corresponding page number in archive?
- How to build a simple nav system of custom post type categories and its posts?
- Shortcode interpreted as text
- scaleability of tags
- Grouping post-types in loop
- So my theme doesn’t have a category.php file
- Template hierarchy: how to let category.php conditionally-load archive.php?
- Getting Category Children
- Break down output of wp_list_categories
- Get the ID of the current post’s child category
- Subcategory Page URL to Display Only Posts from that Subcategory?
- Custom Taxonomy Isotope Grid – Filter Buttons Not Working
- Shop Category Pages missing s
- Menu with category 2 category combined
- Some subcategories not working on custom portfolio sort
- Link For Portfolio Categories
- Displaying Category in sidebar post widget but not in the loop on home
- Media Categories as Classes on WordPress Gallery Shortcode
- Category Template for Custom Post Type
- Loop Through Categories in Custom Field
- Loop through posts of CatA and store value of CatB in separate array
- Highlight posts that belong to current sub category
- Problem with single posts not showing correct category sidebar
- Multiple Categories under one URL, where ‘Front Page’ is used already
- finding out the top 5 source ( source is a custom taxonomy ), in a given category
- WordPress category gives 404 after moving to a different domain
- How to load/include category templates based on conditionals?
- Why does WordPress append a bullet to my category tag?
- how to implement next/prev within category archive?
- Invalid login email notification for password-protected category