Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

query wordpress posts by polylang language on MySQL

I'm trying to build a MySQL query to select last post by language (Polylang plugin) but I can't find what table and field does Polylang store the language of each post. Any clue?

like image 909
Matias Masso Avatar asked Aug 30 '26 01:08

Matias Masso


1 Answers

The following mysql query will find all published wordpress posts which is in en language of polylang plugin:

SELECT * FROM wp_posts WHERE post_status = 'publish' AND ID IN (
SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(description, '"en";i:', -1), ';',1) FROM `wp_term_taxonomy` WHERE `taxonomy` = 'post_translations' ) order by ID desc
like image 68
xinqiu Avatar answered Sep 05 '26 17:09

xinqiu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!