Feature request: Do not show translations as separate posts in administration
-
Hi all,
I found really weird to display a separate post for every translation in administration. I simply could not imagine me explaning how it works to my customers.
So, when a user is listing posts in administration, I restrict them only to a default language mutation. There is enough widgets everywhere to get to translations.
Only few lines of code needed without changing any file of Polylang plugin:
add_filter( 'pre_get_posts', 'restrict_query_to_default_language'); function restrict_query_to_default_language(WP_Query $query) { if (is_admin()) { $orig_tax_query = $query->get('tax_query'); $new_tax_query = array('taxonomy' => 'language', 'field' => 'slug', 'terms' => array(pll_default_language())); if ($orig_tax_query !== null) { $query->set('tax_query', array('relation' => 'AND', $new_tax_query, $orig_tax_query)); } else { $query->set('tax_query', array($new_tax_query)); } } }
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Feature request: Do not show translations as separate posts in administration’ is closed to new replies.