i need to display the category list related to the current page (based on selected category in admin.) in wordpress site. i tried with get_the_category($post_id). But it’s not working. Thanks.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can try get_the_terms() instead. It should return an array of cats. WordPress considers categories a taxonomy, so specifying ‘category’ as the taxonomy type should do the trick.Hope this helps.
Function reference here.