I am using the WordPress and I have created a custom post type. Also, I have added the custom field for each custom post.
Now I have to fetch the data from the database and I tried the below query
SELECT p.ID,
p.post_date,
pm.meta_key,
pm.meta_value
FROM wp_posts p
INNER JOIN wp_postmeta pm
ON p.ID = pm.post_id
WHERE p.post_type = 'test'
AND p.post_status = 'publish' and p.ID=972
The above query is working and I am getting the below output. (It's just an example of the screenshot.)
Now my issue is, Is it possible using a query to get the only dropboxlink2
and dropboxlink3
values? As of now I am getting all the custom post field list
Note: I know how to get in the WordPress but I need a solution in PHP and MySQL