我创建此SQL查询是为了生成帖子列表(我将用于CSV工作表)
SELECT p.ID, p.post_content, p.post_title, pm1.meta_value as \'Amazon.com\', pm2.meta_value as \'Amazon.co.uk\'
FROM wp_posts p
LEFT JOIN wp_postmeta pm1 ON p.ID = pm1.post_id AND pm1.meta_key = \'Amazon.com\'
LEFT JOIN wp_postmeta pm2 ON p.ID = pm2.post_id AND pm2.meta_key = \'Amazon.co.uk\'
WHERE post_type = \'post\' AND post_status = \'publish\'
我正试图使用WP-CLI、使用“WP list”等实现同样的功能,但我还无法找到一种方法,将所有帖子及其元字段列在一行中。
如何使用WP-CLI实现这一点?