Thank you.
but i need at that stage so.
I have tried with query and finally got it.
function get_terms_by_post_type( $taxonomies, $post_types, $pId ) {
global $wpdb;
$query = $wpdb->prepare(
"SELECT t.*, COUNT(*) from $wpdb->terms AS t
INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id
INNER JOIN $wpdb->term_relationships AS r ON r.term_taxonomy_id = tt.term_taxonomy_id
INNER JOIN $wpdb->posts AS p ON p.ID = r.object_id
WHERE p.post_type IN('%s') AND tt.taxonomy IN('%s') AND p.ID = $pId
GROUP BY t.term_id",
join( "', '", $post_types ),
join( "', '", $taxonomies )
);
$results = $wpdb->get_results( $query );
return $results;
}
function get_description_by_term_id( $termid ) {
global $wpdb;
$query = "SELECT t.* from $wpdb->term_taxonomy AS t
WHERE t.term_id = $termid
GROUP BY t.term_id";
$results = $wpdb->get_results( $query );
return $results;
}
$terms = get_terms_by_post_type( array('product_cat'), array('product'), $product_id );
$termDescription = get_description_by_term_id($terms['0']->term_id);
Is there any other way?
Then plz mention.
Again thank you for your kind response.