Query to fetch custom taxonomy along with post title

If we want to display taxonomy name along with post title in backend MYSQL query you can use this query :- SELECT p.ID,taxonomy,post_title,post_status,name FROM wp_posts p, wp_term_relationships rel, wp_terms t, wp_term_taxonomy te where p.ID = rel.object_id AND t.term_id=te.term_id AND t.term_id=rel.term_taxonomy_id AND taxonomy in (‘taxonomy’) AND Post_type=”post” and name=”name of taxonomy”

Custom Taxonomy – Modify Function to Get Child Category

if it is for product categories, this function only needs the category id to know the childrens: function cat_childs( $term_id = 0) { $children = get_terms( array( ‘child_of’ => $term_id, ‘taxonomy’ => ‘product_cat’, ‘hide_empty’ => true, ‘fields’ => ‘ids’, )); return ( $children ); } can be called like this: cat_childs(1234); because it can return … Read more