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

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

$
0
0

When using translated media, how can I query for attachments independent of the current language?

Unlike WPML, Polylang does not copy attachments to translated posts. Which is fine for my current project.
Also, from the uploader I will only see media in the same language as the post I'm looking at.

Now I would expect to be able to use get_posts in this fashion:

1) If this is a translated post, get the original post. This works fine.

2) Then: use get_posts to get the attachments for the original posts:

$args = array(
		'post_type'  => 'attachment',
		'lang'	=> 'en', // language of original post
		'post_parent' => $post_id // id of original post
	);
$attachments = get_posts($args);

This doesn't return any results. What is the expected behavior, and what should I do?

http://wordpress.org/plugins/polylang/


Viewing all articles
Browse latest Browse all 11471

Trending Articles



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