Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

how to get postmeta info based on multiple categories?

ok, I was close and I have solution:

SELECT wp_posts.ID, wp_postmeta.meta_value FROM wp_postmeta    
INNER JOIN wp_posts ON wp_posts.ID = wp_postmeta.post_id
INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id)  
INNER JOIN wp_term_relationships AS tt1 ON (wp_posts.ID = tt1.object_id) 
WHERE 1=1 
AND wp_postmeta.meta_key = '_application'
AND ( wp_term_relationships.term_taxonomy_id IN (31) 
  AND 
  tt1.term_taxonomy_id IN (14)
) 

Related Posts:

  1. Custom Query to search through categories
  2. How Do I Merge Categories With phpMyAdmin
  3. Disallow categories from this MySQL query
  4. How to get related tags based on a category?
  5. How Do I Delete WordPress Posts Older Than 400 Days, From A WordPress Category
  6. is_category() in pre_get_posts strange error
  7. Checklist of selected categories
  8. Rearranging posts based on categories
  9. Custom query with category exclusion and post-meta “whitelist”
  10. How to create 450 categories in wp
  11. How to query all posts of a specific category, and any other category combination
  12. is_category in pre_get_posts results in php notices
  13. Query the Loop without breaking it
  14. How to Check if a Child Category is Being Queried
  15. Hide post meta data on a specific category
  16. Grouping related postmeta data via SQL query
  17. Category archive page – loop through posts of certain tag (with pagination) – pre_get_posts
  18. If newest post of category is newest post in general, skip first post of category
  19. mySQL query. ORDER BY meta_key
  20. How to show author name only if the post is in a specific category?
  21. Include posts from feature category in pre_get_posts
  22. Accessing WordPress MySQL Database via Data Connection in Visual Studio 2010 using C#
  23. How to display posts under a specific subcategory of a given category
  24. get_the_category and echo out link to child-most/deepest category
  25. Change the category of all posts in it
  26. How to run select query of post with category and tags for API?
  27. query in category.php repeats itself
  28. Display posts separated by Category in Author’s page
  29. How to display singular form of category name?
  30. Category param redirect to post type archive
  31. SQL to migrate post types to taxonomy
  32. Show popular post by category code
  33. How to get latest posts from each category in regular order
  34. Drop posts from categories in MySql
  35. category pagination got broken suddenly
  36. get_post_meta not working on category.php
  37. WordPress Post # of # filtered by category slug
  38. How to query categories with Advanced Custom Fields?
  39. Hidde certain category from post meta
  40. Where and when does WordPress invoke routes
  41. Can Categories be used to hack a Multisite-like setup w/ a single MySql db?
  42. And/Or Category Query
  43. Exclude category from query
  44. Is there a way to only show Custom Meta Data on single posts from certain catagories
  45. Overriding default calendar to show posts from a category
  46. How to modify the output of wp_terms_checklist when used within the built-in category metabox on edit posts?
  47. How to list all categories and their IDs using SQL query?
  48. function query_posts disabling current_page_menu class
  49. Get Meta Keys of Custom Categories
  50. Custom meta boxes ID prefix showing on first category but not others
  51. Using in ‘category_name’ in ‘$query->set();’?
  52. custom query for both category and pages using global $wpdb;
  53. Get categories of queried posts
  54. Query from multiple category (and)
  55. How to display posts from specific category using get_option function?
  56. SQL query to get posts from multiple categories but not in a category
  57. Conditional category query breaking?
  58. WordPress: Using the category slug get the category ID using mysql query
  59. How to add categories using mysql
  60. How to filter post from categories only if the posts appears in one of them, not the other?
  61. Category name for all posts getting assigned to a single random post
  62. Show Posts via cat+cat in URL that are in both Categories doesn’t work
  63. Sending all categories associated with a post to Google Ad Manager for use with .setTargeting
  64. List of post categories only associated to another custom taxonomy
  65. how tho change number of posts in loop from specific categories
  66. Remove “Category:” from Post meta
  67. Displaying data from custom fields on a specific category page
  68. How do I merge WooCommerce categories with the same name?
  69. Please tell how to stop the category from showing up on posts
  70. Get category from slug list
  71. Bulk Change WordPress category Slug
  72. Issue with WordPress category search
  73. Querying posts from two different categories while looping inside another loop
  74. Too many categories drastically slow down my website
  75. How to get posts from many categories using WP_Query
  76. Is it possible to query the result of a query?
  77. show posts found in multiple categories via category_name query string?
  78. Custom MySQL Query for Post and Post Meta
  79. Match two taxonomies to display a specific content
  80. How can I hide the category term for posts with none set?
  81. Category slug in in loop always the same?
  82. display certain category on custom template page
  83. Detecting top parent category fails on home page
  84. How to use Greek characters/letters in a query?
  85. Displaying posts by year
  86. wordpress category.php query for featured news item, broken pagination and repeating posts
  87. finding out the top 5 source ( source is a custom taxonomy ), in a given category
  88. How to make that all posts with a category belong also to another
  89. How to show posts of a specific category
  90. How to get parent and child sub category (Taxonomy) order to display
  91. select posts from sql except posts from specific category
  92. How to query by subcategory and, if there are fewer than 10 posts in that subcategory, fill out with posts from parent category
  93. How to make query loop block dynamic
  94. Display posts of certain categories to specific user roles
  95. related articles using shortcodes
  96. Adding additional content on post depending on post categories
  97. How to access deleted term inside delete_product_cat action
  98. Remove parent category from child/sub-category page URL in WordPress
  99. How to restrict category creation to admins only while allowing editors to still pick category
  100. Adding a H1 Tag to Post Tags automatically, but hide the tag? (Same for Category)
Categories categories Tags categories, mysql, post-meta, query
sharing the same cookie session with multiple wordpress installs on the same domain?
I can’t write in my DB using $wpdb->insert

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Post Navigation Elementor
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • WPFacet multiple loop displaying duplicate content
  • Get the name of the template/*html file used
  • Fix: WordPress.DB.PreparedSQL.NotPrepared Plugin Check (PCP)
  • Removing unnecessary CSS and JS code from wp_head()
  • hexagonal image gallery. Am I on the right track? [closed]
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
© 2026 Read For Learn
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress