So I have the following SQL script where I can view all my post_meta with specific meta_keys:
SELECT * FROM `wp_postmeta`
WHERE `meta_key` = 'honorific'
OR `meta_key` = 'suffix'
OR `meta_key` = 'nickname'
Is there anyway that I can make it where instead of giving me ALL the post_meta with those keys, it gives me just the post_metas that match a specific post type such as 'test'?
I tried:
SELECT * p.post_type FROM wp_posts p ` INNER JOIN `wp_postmeta`
----- Also:
SELECT p.ID,
p.post_title
FROM wp_posts p
INNER JOIN wp_postmeta AS pm ON pm.post_id = p.ID
WHERE
pm.meta_key = 'honorific' AND p.post_type = 'employee'
That's where I'm kinda of stuck at - All help will be appreciated.
Basically:
- Give me post_meta that equals honorific, suffix and nickname with posts related to custom post type test.