最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

plugins - How to get the custom field value using SQL query

programmeradmin4浏览0评论

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

发布评论

评论列表(0)

  1. 暂无评论