Quantcast
Channel: polylang – WordPress.org Forums
Viewing all articles
Browse latest Browse all 11471

Chouby on "[Plugin: Polylang] get attachments for original post"

$
0
0

I believe that this should get the attachments of the translated parent:

$args = array(
	'post_type'  => 'attachment',
	'post_parent' => pll_get_post($post_id, 'en')
);
$attachments = get_posts($args);

You have to set PLL_AUTO_TRANSLATE to false as otherwise Polylang will come set the post_parent to the current language.


Viewing all articles
Browse latest Browse all 11471

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>