WordPress: parent category ID given current category ID? olatechproFebruary 25, 20231 Views I’m learning wordpress. How can I get the PARENT CATEGORY ID from the CURRENT CATEGORY ID?Read MoreWooCommerce: get_current_screen not working with multi languageCan’t login on WordPressWordPress: Ajax not working to insert, query and result data Thanks Post Views: 1 Related postsGet rid of this Strict Standards warningWooCommerce: get_current_screen not working with multi languageCan’t login on WordPressForce HTTPS using .htaccess – stuck in redirect loopWordPress: Ajax not working to insert, query and result dataHow Can I pass an image file to wp_handle_upload?
Search Google and uou will flooded with answers. Check the following WordPress function and other links. WordPress has the inbuilt function get category parents Other useful Links: WORDPRESS: GET ID OF TOP-LEVEL PARENT CATEGORY How to get parent category name in WordPress WordPress – Get Current Category Parents Log in to Reply
$childCat = get_category($child_category_id); $parentCat = get_category($childCat->parent); Log in to Reply
Search Google and uou will flooded with answers. Check the following WordPress function and other links.
WordPress has the inbuilt function get category parents
Other useful Links:
CATEGORY
WordPress
Parents
this should do it nice and simple
All the best
Adi
http://www.mindmyweb.com