Mysql SELECT posts

Question

how i can get posts via MYSQL from posts where language is ‘en’ and ‘ru’

I have this query

$sql = "SELECT p1.*, wm2.meta_value 
  FROM wp_posts p1 
  LEFT JOIN wp_postmeta wm1 ON ( wm1.post_id = p1.ID 
  AND wm1.meta_value IS NOT NULL 
  AND wm1.meta_key = '_thumbnail_id' ) 
  LEFT JOIN wp_postmeta wm2 ON ( wm1.meta_value = wm2.post_id 
  AND wm2.meta_key = '_wp_attached_file' 
  AND wm2.meta_value IS NOT NULL ) 
  WHERE p1.post_status= 'publish' AND p1.post_type='post' ORDER BY p1.post_date DESC Limit 3";

I use WPML plugin.

0
, Valeriy Donika 6 years 2015-08-08T07:13:38-05:00 0 Answers 83 views 0

Leave an answer

Browse
Browse