I’ve a customized put up kind referred to as media_coverage
and must export by way of PHPMyAdmin among the information in that put up kind that’s in wp_posts
(post_title
) and likewise in wp_postmeta
(meta_key
).
I clearly want to make use of the post_id, however I do not know find out how to dynamically cross the post_id
within the question to get the info from each the wp_posts
and wp_postmeta tables
.
And, I do not know find out how to get a number of meta_key
values on the identical time from wp_postmeta
.
What I’ve labored by means of in PHPMyAdmin:
• This question exhibits me all of the posts and post_id’s, and so on, for the media_coverage
customized put up kind:
SELECT* FROM wp_posts WHERE post_type="media_coverage"
• The post_title
is one bit of knowledge I must retrieve; this exhibits me all of the put up titles of all of the media_coverage
posts from wp_posts
:
SELECT post_title FROM wp_posts WHERE post_type="media_coverage"
• However what I must do can be retrieve a number of meta_key
values from wp_postmeta
; this offers me one of many meta_keys
referred to as coverage_url
:
SELECT* FROM wp_postmeta WHERE post_id = '82080' AND meta_key = 'coverage_url'
However that is solely from put up ID 82080, as I do not know find out how to have the question use all the post_id’s of obtainable media_coverage
posts.
So how do I assemble a question like this:
SELECT* FROM wp_posts WHERE post_type=”media_coverage” AND
(pseudo code)
the post_title from that post_id in wp_posts
and the meta_key = ‘source_name’ from that post_id in wp_postmeta
and the meta_key = ‘coverage_url’ from that post_id in wp_postmeta