{"id":776,"date":"2012-06-05T14:08:19","date_gmt":"2012-06-05T14:08:19","guid":{"rendered":"https:\/\/theextremewebdesigns.com\/blog\/?p=776"},"modified":"2012-06-05T14:08:19","modified_gmt":"2012-06-05T14:08:19","slug":"wordpress-get-category-name-by-id-inside-or-outside-loop","status":"publish","type":"post","link":"https:\/\/theextremewebdesigns.com\/blog\/wordpress-get-category-name-by-id-inside-or-outside-loop\/","title":{"rendered":"WordPress Get Category Name by ID : Inside or Outside loop"},"content":{"rendered":"<p><strong>WordPress Get Category Name by ID:<\/strong> It is very simple and easy to get category name by category ID, inside or outside loop in WordPress. You can do it by using just 1 line of code. Read on to find out more.<!--more--><\/p>\n<h2>WordPress Get Category Name by ID &#8211; Inside or Outside loop<\/h2>\n<pre class=\"lang:php decode:true\">$cat_name = get_cat_name($cat_id);\n\necho $cat_name;<\/pre>\n<p>You can use the above code Inside or Outside loop of WordPress to get the Category name, just by using Category ID.<\/p>\n<p>If you wish to, you can also encapsulate the above lines of code in a function and simply return the value from the function\u00a0instead\u00a0of just echoing it.<\/p>\n<p><strong>That&#8217;s it!<\/strong><\/p>\n<p>Do you know of any other ways to <strong>get category name by id in wordpress<\/strong>? Feel free to suggest by commenting below.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>WordPress Get Category Name by ID: It is very simple and easy to get category name by category ID, inside or outside loop in WordPress. You can do it by using just 1 line of code. Read on to find out more.<\/p>\n","protected":false},"author":1,"featured_media":114,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[13,11],"tags":[30],"class_list":["post-776","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tips-and-tricks","category-wordpress-tips-and-tricks","tag-wordpress-tips"],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/paBnQX-cw","jetpack_sharing_enabled":true,"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/posts\/776","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/comments?post=776"}],"version-history":[{"count":0,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/posts\/776\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/"}],"wp:attachment":[{"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/media?parent=776"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/categories?post=776"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/tags?post=776"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}