php - How can i get the list of Categories a specific Wordpress page is assigned to?
Get the solution ↓↓↓Solution:
Frist: wp dont have default category for page so you have to create custom taxonomy for page.
register_taxonomy( $taxonomy, $object_type, $args );
check this https://developer.wordpress.org/reference/functions/register_taxonomy/
Next: get that categoies list
$page_terms = get_the_terms( $page_id, $taxonomy );
check this https://developer.wordpress.org/reference/functions/get_the_terms/
i think it will be helpful for you.
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: illegal string offset
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.