I want to get meta data by custom post type category name.

Right now i am getting all meta data but i want specific for each category

$partSql = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."postmeta WHERE meta_key = 'prd_part_no'", ARRAY_A);

1 Answer 1


You can use the get_post_meta function in wordpress to achieve this, that's a link get_post_meta to it in the wordpress codex.

  • Thank you But i want get post meta by category. Right now i am getting all post meta, but i want to display who are available in category.
    – Ravi patel
    Commented Mar 24, 2017 at 10:43
  • You can get post meta by category by using this function <?php get_metadata($meta_type, $object_id, $meta_key, $single) ?> For more details refer this link codex.wordpress.org/Function_Reference/get_metadata Commented Mar 24, 2017 at 10:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.