PLL_Admin_Filters_Post

Manages filters and actions related to posts on admin side.

Defined (1)

The class is defined in the following location(s).

/admin/admin-filters-post.php  
  1. class PLL_Admin_Filters_Post extends PLL_Admin_Filters_Post_Base { 
  2. public $options, $curlang; 
  3.  
  4. /** 
  5. * Constructor: setups filters and actions 
  6. * @since 1.2 
  7. * @param object $polylang 
  8. */ 
  9. public function __construct( &$polylang ) { 
  10. parent::__construct( $polylang ); 
  11. $this->options = &$polylang->options; 
  12. $this->curlang = &$polylang->curlang; 
  13.  
  14. add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) ); 
  15.  
  16. // Filters posts, pages and media by language 
  17. add_action( 'parse_query', array( $this, 'parse_query' ) ); 
  18.  
  19. // Adds the Languages box in the 'Edit Post' and 'Edit Page' panels 
  20. add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ), 10, 2 ); 
  21.  
  22. // Ajax response for changing the language in the post metabox 
  23. add_action( 'wp_ajax_post_lang_choice', array( $this, 'post_lang_choice' ) ); 
  24. add_action( 'wp_ajax_pll_posts_not_translated', array( $this, 'ajax_posts_not_translated' ) ); 
  25.  
  26. // Adds actions and filters related to languages when creating, saving or deleting posts and pages 
  27. add_action( 'save_post', array( $this, 'save_post' ), 21, 3 ); // Priority 21 to come after advanced custom fields ( 20 ) and before the event calendar which breaks everything after 25 
  28. add_filter( 'wp_insert_post_parent', array( $this, 'wp_insert_post_parent' ), 10, 4 ); 
  29. add_action( 'before_delete_post', array( $this, 'delete_post' ) ); 
  30. if ( $this->options['media_support'] ) { 
  31. add_action( 'delete_attachment', array( $this, 'delete_post' ) ); // Action shared with media 
  32.  
  33. // Filters the pages by language in the parent dropdown list in the page attributes metabox 
  34. add_filter( 'page_attributes_dropdown_pages_args', array( $this, 'page_attributes_dropdown_pages_args' ), 10, 2 ); 
  35.  
  36. /** 
  37. * Outputs a javascript list of terms ordered by language and hierarchical taxonomies 
  38. * to filter the category checklist per post language in quick edit 
  39. * Outputs a javascript list of pages ordered by language 
  40. * to filter the parent dropdown per post language in quick edit 
  41. * @since 1.7 
  42. */ 
  43. public function admin_enqueue_scripts() { 
  44. $screen = get_current_screen(); 
  45.  
  46. // Hierarchical taxonomies 
  47. if ( 'edit' == $screen->base && $taxonomies = get_object_taxonomies( $screen->post_type, 'object' ) ) { 
  48. // Get translated hierarchical taxonomies 
  49. foreach ( $taxonomies as $taxonomy ) { 
  50. if ( $taxonomy->hierarchical && $taxonomy->show_in_quick_edit && $this->model->is_translated_taxonomy( $taxonomy->name ) ) { 
  51. $hierarchical_taxonomies[] = $taxonomy->name; 
  52.  
  53. if ( ! empty( $hierarchical_taxonomies ) ) { 
  54. $terms = get_terms( $hierarchical_taxonomies, array( 'get' => 'all' ) ); 
  55.  
  56. foreach ( $terms as $term ) { 
  57. if ( $lang = $this->model->term->get_language( $term->term_id ) ) { 
  58. $term_languages[ $lang->slug ][ $term->taxonomy ][] = $term->term_id; 
  59.  
  60. // Send all these data to javascript 
  61. if ( ! empty( $term_languages ) ) { 
  62. wp_localize_script( 'pll_post', 'pll_term_languages', $term_languages ); 
  63.  
  64. // Hierarchical post types 
  65. if ( 'edit' == $screen->base && is_post_type_hierarchical( $screen->post_type ) ) { 
  66. $pages = get_pages(); 
  67.  
  68. foreach ( $pages as $page ) { 
  69. if ( $lang = $this->model->post->get_language( $page->ID ) ) { 
  70. $page_languages[ $lang->slug ][] = $page->ID; 
  71.  
  72. // Send all these data to javascript 
  73. if ( ! empty( $page_languages ) ) { 
  74. wp_localize_script( 'pll_post', 'pll_page_languages', $page_languages ); 
  75.  
  76. /** 
  77. * Filters posts, pages and media by language 
  78. * @since 0.1 
  79. * @param object $query a WP_Query object 
  80. */ 
  81. public function parse_query( $query ) { 
  82. $qvars = &$query->query_vars; 
  83.  
  84. // Do not filter post types such as nav_menu_item 
  85. if ( isset( $qvars['post_type'] ) && ! $this->model->is_translated_post_type( $qvars['post_type'] ) ) { 
  86. unset( $qvars['lang'] ); 
  87. return; 
  88.  
  89. // Do not filter the query if the language is already specified in another way 
  90. if ( ! isset( $qvars['lang'] ) ) { 
  91. $excludes = array( 
  92. 'p',  
  93. 'post_parent',  
  94. 'attachment',  
  95. 'attachment_id',  
  96. 'name',  
  97. 'pagename',  
  98. 'page_id',  
  99. 'category_name',  
  100. 'tag',  
  101. 'cat',  
  102. 'tag_id',  
  103. 'category__in',  
  104. 'category__and',  
  105. 'post__in',  
  106. 'post_name__in',  
  107. 'tag__in',  
  108. 'tag__and',  
  109. 'tag_slug__in',  
  110. 'tag_slug__and',  
  111. 'post_parent__in',  
  112. ); 
  113.  
  114. foreach ( $excludes as $k ) { 
  115. if ( ! empty( $qvars[ $k ] ) ) { 
  116. return; 
  117.  
  118. $taxonomies = array_intersect( $this->model->get_translated_taxonomies(), get_taxonomies( array( '_builtin' => false ) ) ); 
  119.  
  120. foreach ( $taxonomies as $tax ) { 
  121. $tax = get_taxonomy( $tax ); 
  122. if ( ! empty( $qv[ $tax->query_var ] ) ) { 
  123. return; 
  124.  
  125. if ( ! empty( $qvars['tax_query'] ) && is_array( $qvars['tax_query'] ) && $this->model->have_translated_taxonomy( $qvars['tax_query'] ) ) { 
  126. return; 
  127.  
  128. // Filter queries according to the current language 
  129. if ( isset( $qvars['post_type'] ) && ! empty( $this->curlang ) ) { 
  130. $qvars['lang'] = $this->curlang->slug; 
  131.  
  132. if ( isset( $qvars['lang'] ) && 'all' === $qvars['lang'] ) { 
  133. unset( $qvars['lang'] ); 
  134.  
  135. /** 
  136. * Adds the Language box in the 'Edit Post' and 'Edit Page' panels ( as well as in custom post types panels ) 
  137. * Removes the editor for translations of the pages for posts 
  138. * @since 0.1 
  139. * @param string $post_type 
  140. */ 
  141. public function add_meta_boxes( $post_type, $post ) { 
  142. if ( $this->model->is_translated_post_type( $post_type ) ) { 
  143. add_meta_box( 'ml_box', __( 'Languages', 'polylang' ), array( $this, 'post_language' ), $post_type, 'side', 'high' ); 
  144.  
  145. if ( ( $page_for_posts = get_option( 'page_for_posts' ) ) && ( $translations = $this->model->post->get_translations( $page_for_posts ) ) && in_array( $post->ID, $translations ) && empty( $post->post_content ) ) { 
  146. add_action( 'edit_form_after_title', '_wp_posts_page_notice' ); 
  147. remove_post_type_support( $post_type, 'editor' ); 
  148.  
  149. /** 
  150. * Displays the Languages metabox in the 'Edit Post' and 'Edit Page' panels 
  151. * @since 0.1 
  152. */ 
  153. public function post_language() { 
  154. global $post_ID; 
  155. $post_id = $post_ID; 
  156. $post_type = get_post_type( $post_ID ); 
  157.  
  158. $lang = ( $lg = $this->model->post->get_language( $post_ID ) ) ? $lg : 
  159. ( isset( $_GET['new_lang'] ) ? $this->model->get_language( $_GET['new_lang'] ) : 
  160. $this->pref_lang ); 
  161.  
  162. $dropdown = new PLL_Walker_Dropdown(); 
  163.  
  164. wp_nonce_field( 'pll_language', '_pll_nonce' ); 
  165.  
  166. // NOTE: the class "tags-input" allows to include the field in the autosave $_POST ( see autosave.js ) 
  167. printf( ' 
  168. <p><strong>%1$s</strong></p> 
  169. <label class="screen-reader-text" for="%2$s">%1$s</label> 
  170. <div id="select-%3$s-language">%4$s</div>',  
  171. esc_html__( 'Language', 'polylang' ),  
  172. $id = ( 'attachment' === $post_type ) ? sprintf( 'attachments[%d][language]', $post_ID ) : 'post_lang_choice',  
  173. 'attachment' === $post_type ? 'media' : 'post',  
  174. $dropdown->walk( $this->model->get_languages_list(), array( 
  175. 'name' => $id,  
  176. 'class' => 'post_lang_choice tags-input',  
  177. 'selected' => $lang ? $lang->slug : '',  
  178. 'flag' => true,  
  179. ) ) 
  180. ); 
  181.  
  182. /** 
  183. * Fires before displaying the list of translations in the Languages metabox for posts 
  184. * @since 1.8 
  185. */ 
  186. do_action( 'pll_before_post_translations', $post_type ); 
  187.  
  188. echo '<div id="post-translations" class="translations">'; 
  189. if ( $lang ) { 
  190. include PLL_ADMIN_INC . '/view-translations-' . ( 'attachment' == $post_type ? 'media' : 'post' ) . '.php'; 
  191. echo '</div>' . "\n"; 
  192.  
  193. /** 
  194. * Ajax response for changing the language in the post metabox 
  195. * @since 0.2 
  196. */ 
  197. public function post_lang_choice() { 
  198. check_ajax_referer( 'pll_language', '_pll_nonce' ); 
  199.  
  200. global $post_ID; // Obliged to use the global variable for wp_popular_terms_checklist 
  201. $post_id = $post_ID = (int) $_POST['post_id']; 
  202. $lang = $this->model->get_language( $_POST['lang'] ); 
  203.  
  204. $post_type = $_POST['post_type']; 
  205. $post_type_object = get_post_type_object( $post_type ); 
  206. if ( ! current_user_can( $post_type_object->cap->edit_post, $post_ID ) ) { 
  207. wp_die( -1 ); 
  208.  
  209. $this->model->post->set_language( $post_ID, $lang ); // Save language, useful to set the language when uploading media from post 
  210.  
  211. ob_start(); 
  212. if ( $lang ) { 
  213. include PLL_ADMIN_INC . '/view-translations-' . ( 'attachment' == $post_type ? 'media' : 'post' ) . '.php'; 
  214. $x = new WP_Ajax_Response( array( 'what' => 'translations', 'data' => ob_get_contents() ) ); 
  215. ob_end_clean(); 
  216.  
  217. // Categories 
  218. if ( isset( $_POST['taxonomies'] ) ) { 
  219. // Not set for pages 
  220. foreach ( $_POST['taxonomies'] as $taxname ) { 
  221. $taxonomy = get_taxonomy( $taxname ); 
  222.  
  223. ob_start(); 
  224. $popular_ids = wp_popular_terms_checklist( $taxonomy->name ); 
  225. $supplemental['populars'] = ob_get_contents(); 
  226. ob_end_clean(); 
  227.  
  228. ob_start(); 
  229. // Use $post_ID to remember ckecked terms in case we come back to the original language 
  230. wp_terms_checklist( $post_ID, array( 'taxonomy' => $taxonomy->name, 'popular_cats' => $popular_ids ) ); 
  231. $supplemental['all'] = ob_get_contents(); 
  232. ob_end_clean(); 
  233.  
  234. $supplemental['dropdown'] = wp_dropdown_categories( array( 
  235. 'taxonomy' => $taxonomy->name,  
  236. 'hide_empty' => 0,  
  237. 'name' => 'new'.$taxonomy->name.'_parent',  
  238. 'orderby' => 'name',  
  239. 'hierarchical' => 1,  
  240. 'show_option_none' => '— '.$taxonomy->labels->parent_item.' —',  
  241. 'echo' => 0,  
  242. ) ); 
  243.  
  244. $x->Add( array( 'what' => 'taxonomy', 'data' => $taxonomy->name, 'supplemental' => $supplemental ) ); 
  245.  
  246. // Parent dropdown list ( only for hierarchical post types ) 
  247. if ( in_array( $post_type, get_post_types( array( 'hierarchical' => true ) ) ) ) { 
  248. $post = get_post( $post_ID ); 
  249.  
  250. // Args and filter from 'page_attributes_meta_box' in wp-admin/includes/meta-boxes.php of WP 4.2.1 
  251. $dropdown_args = array( 
  252. 'post_type' => $post->post_type,  
  253. 'exclude_tree' => $post->ID,  
  254. 'selected' => $post->post_parent,  
  255. 'name' => 'parent_id',  
  256. 'show_option_none' => __( '(no parent)' ),  
  257. 'sort_column' => 'menu_order, post_title',  
  258. 'echo' => 0,  
  259. ); 
  260.  
  261. /** This filter is documented in wp-admin/includes/meta-boxes.php */ 
  262. $dropdown_args = apply_filters( 'page_attributes_dropdown_pages_args', $dropdown_args, $post ); // Since WP 3.3 
  263.  
  264. $x->Add( array( 'what' => 'pages', 'data' => wp_dropdown_pages( $dropdown_args ) ) ); 
  265.  
  266. // Flag 
  267. $x->Add( array( 'what' => 'flag', 'data' => empty( $lang->flag ) ? esc_html( $lang->slug ) : $lang->flag ) ); 
  268.  
  269. // Sample permalink 
  270. $x->Add( array( 'what' => 'permalink', 'data' => get_sample_permalink_html( $post_ID ) ) ); 
  271.  
  272. $x->send(); 
  273.  
  274. /** 
  275. * Ajax response for input in translation autocomplete input box 
  276. * @since 1.5 
  277. */ 
  278. public function ajax_posts_not_translated() { 
  279. check_ajax_referer( 'pll_language', '_pll_nonce' ); 
  280.  
  281. if ( ! post_type_exists( $_GET['post_type'] ) ) { 
  282. die( 0 ); 
  283.  
  284. $post_language = $this->model->get_language( $_GET['post_language'] ); 
  285. $translation_language = $this->model->get_language( $_GET['translation_language'] ); 
  286.  
  287. // Don't order by title: see https://wordpress.org/support/topic/find-translated-post-when-10-is-not-enough 
  288. $args = array( 
  289. 's' => wp_unslash( $_GET['term'] ),  
  290. 'suppress_filters' => 0, // To make the post_fields filter work 
  291. 'lang' => 0, // Avoid admin language filter 
  292. 'numberposts' => 20, // Limit to 20 posts 
  293. 'post_status' => 'any',  
  294. 'post_type' => $_GET['post_type'],  
  295. 'tax_query' => array( array( 
  296. 'taxonomy' => 'language',  
  297. 'field' => 'term_taxonomy_id', // WP 3.5+ 
  298. 'terms' => $translation_language->term_taxonomy_id,  
  299. ) ),  
  300. ); 
  301.  
  302. /** 
  303. * Filter the query args when auto suggesting untranslated posts in the Languages metabox 
  304. * This should help plugins to fix some edge cases 
  305. * @see https://wordpress.org/support/topic/find-translated-post-when-10-is-not-enough 
  306. * @since 1.7 
  307. * @param array $args WP_Query arguments 
  308. */ 
  309. $args = apply_filters( 'pll_ajax_posts_not_translated_args', $args ); 
  310. $posts = get_posts( $args ); 
  311.  
  312. $return = array(); 
  313.  
  314. foreach ( $posts as $key => $post ) { 
  315. if ( ! $this->model->post->get_translation( $post->ID, $post_language ) ) { 
  316. $return[] = array( 
  317. 'id' => $post->ID,  
  318. 'value' => $post->post_title,  
  319. 'link' => $this->links->edit_post_translation_link( $post->ID ),  
  320. ); 
  321.  
  322. // Add current translation in list 
  323. if ( $post_id = $this->model->post->get_translation( (int) $_GET['pll_post_id'], $translation_language ) ) { 
  324. $post = get_post( $post_id ); 
  325. array_unshift( $return, array( 
  326. 'id' => $post_id,  
  327. 'value' => $post->post_title,  
  328. 'link' => $this->links->edit_post_translation_link( $post_id ),  
  329. ) ); 
  330.  
  331. wp_die( json_encode( $return ) ); 
  332.  
  333. /** 
  334. * Saves language 
  335. * Checks the terms saved are in the right language 
  336. * @since 1.5 
  337. * @param int $post_id 
  338. * @param array $post 
  339. */ 
  340. protected function save_language( $post_id, $post ) { 
  341. // Security checks are necessary to accept language modifications as 'wp_insert_post' can be called from outside WP admin 
  342.  
  343. // Edit post 
  344. if ( isset( $_POST['post_lang_choice'], $_POST['post_ID'] ) && $_POST['post_ID'] == $post_id ) { 
  345. check_admin_referer( 'pll_language', '_pll_nonce' ); 
  346. $this->model->post->set_language( $post_id, $lang = $this->model->get_language( $_POST['post_lang_choice'] ) ); 
  347.  
  348. // Quick edit and bulk edit 
  349. // POST for quick edit, GET for bulk edit 
  350. elseif ( isset( $_REQUEST['inline_lang_choice'] ) ) { 
  351. // Bulk edit does not modify the language 
  352. if ( isset( $_GET['bulk_edit'] ) && -1 == $_REQUEST['inline_lang_choice'] ) { 
  353. check_admin_referer( 'bulk-posts' ); 
  354. $lang = $this->model->post->get_language( $post_id ); // Get the post language for later use when saving terms 
  355. // A language is set in the language dropdown 
  356. else { 
  357. isset( $_GET['bulk_edit'] ) ? check_admin_referer( 'bulk-posts' ) : check_admin_referer( 'inlineeditnonce', '_inline_edit' ); 
  358.  
  359. $old_lang = $this->model->post->get_language( $post_id ); // Stores the old language 
  360. $this->model->post->set_language( $post_id, $lang = $this->model->get_language( $_REQUEST['inline_lang_choice'] ) ); // set new language 
  361.  
  362. // Checks if the new language already exists in the translation group 
  363. if ( $old_lang && $old_lang->slug != $lang->slug ) { 
  364. $translations = $this->model->post->get_translations( $post_id ); 
  365.  
  366. // If yes, separate this post from the translation group 
  367. if ( array_key_exists( $lang->slug, $translations ) ) { 
  368. $this->model->post->delete_translation( $post_id ); 
  369.  
  370. elseif ( array_key_exists( $old_lang->slug, $translations ) ) { 
  371. unset( $translations[ $old_lang->slug ] ); 
  372. $this->model->post->save_translations( $post_id, $translations ); 
  373.  
  374. // Quick press 
  375. // 'post-quickpress-save', 'post-quickpress-publish' = backward compatibility WP < 3.8 
  376. elseif ( isset( $_REQUEST['action'] ) && in_array( $_REQUEST['action'], array( 'post-quickpress-save', 'post-quickpress-publish', 'post-quickdraft-save' ) ) ) { 
  377. check_admin_referer( 'add-' . $post->post_type ); 
  378. $this->model->post->set_language( $post_id, $lang = $this->pref_lang ); // Default language for Quick draft 
  379.  
  380. else { 
  381. $this->set_default_language( $post_id ); 
  382.  
  383. // Make sure we get save terms in the right language (especially tags with same name in different languages) 
  384. if ( ! empty( $lang ) ) { 
  385. // FIXME quite a lot of queries in foreach 
  386. foreach ( $this->model->get_translated_taxonomies() as $tax ) { 
  387. $terms = get_the_terms( $post_id, $tax ); 
  388.  
  389. if ( is_array( $terms ) ) { 
  390. $newterms = array(); 
  391. foreach ( $terms as $term ) { 
  392. // Check if the term is in the correct language or if a translation exist ( mainly for default category ) 
  393. if ( $newterm = $this->model->term->get( $term->term_id, $lang ) ) { 
  394. $newterms[] = (int) $newterm; 
  395.  
  396. // Or choose the correct language for tags ( initially defined by name ) 
  397. elseif ( $newterm = $this->model->term_exists( $term->name, $tax, $term->parent, $lang ) ) { 
  398. $newterms[] = (int) $newterm; // Cast is important otherwise we get 'numeric' tags 
  399.  
  400. // Or create the term in the correct language 
  401. elseif ( ! is_wp_error( $term_info = wp_insert_term( $term->name, $tax ) ) ) { 
  402. $newterms[] = (int) $term_info['term_id']; 
  403.  
  404. wp_set_object_terms( $post_id, $newterms, $tax ); 
  405.  
  406. /** 
  407. * Called when a post ( or page ) is saved, published or updated 
  408. * saves languages and translations 
  409. * @since 0.1 
  410. * @param int $post_id 
  411. * @param object $post 
  412. * @param bool $update Whether it is an update or not 
  413. */ 
  414. public function save_post( $post_id, $post, $update ) { 
  415. // Does nothing except on post types which are filterable 
  416. if ( ! $this->model->is_translated_post_type( $post->post_type ) ) { 
  417. return; 
  418.  
  419. if ( $id = wp_is_post_revision( $post_id ) ) { 
  420. $post_id = $id; 
  421.  
  422. // Capability check 
  423. // As 'wp_insert_post' can be called from outside WP admin 
  424. $post_type_object = get_post_type_object( $post->post_type ); 
  425. if ( ( $update && current_user_can( $post_type_object->cap->edit_post, $post_id ) ) || ( ! $update && current_user_can( $post_type_object->cap->create_posts ) ) ) { 
  426. $this->save_language( $post_id, $post ); 
  427.  
  428. // Make sure we are saving translations only for the main post currently being edited 
  429. if ( isset( $_POST['post_tr_lang'], $_POST['post_ID'] ) && $_POST['post_ID'] == $post_id ) { 
  430. $translations = $this->save_translations( $post_id, $_POST['post_tr_lang'] ); 
  431.  
  432. /** 
  433. * Fires after the post language and translations are saved 
  434. * @since 1.2 
  435. * @param int $post_id Post id 
  436. * @param object $post Post object 
  437. * @param array $translations The list of translations post ids 
  438. */ 
  439. do_action( 'pll_save_post', $post_id, $post, empty( $translations ) ? $this->model->post->get_translations( $post_id ) : $translations ); 
  440.  
  441. // Attempts to set a default language even if no capability 
  442. else { 
  443. $this->set_default_language( $post_id ); 
  444.  
  445. /** 
  446. * Make sure that the post parent is in the correct language when using bulk edit 
  447. * @since 1.8 
  448. * @param int $post_parent Post parent ID. 
  449. * @param int $post_id Post ID. 
  450. * @param array $new_postarr Array of parsed post data. 
  451. * @param array $postarr Array of sanitized, but otherwise unmodified post data. 
  452. * @return int 
  453. */ 
  454. public function wp_insert_post_parent( $post_parent, $post_id, $new_postarr, $postarr ) { 
  455. if ( isset( $postarr['bulk_edit'] ) ) { 
  456. check_admin_referer( 'bulk-posts' ); 
  457. $lang = -1 == $postarr['inline_lang_choice'] ? 
  458. $this->model->post->get_language( $post_id ) : 
  459. $this->model->get_language( $postarr['inline_lang_choice'] ); 
  460. $post_parent = $this->model->post->get_translation( $post_parent, $lang ); 
  461. return $post_parent; 
  462.  
  463. /** 
  464. * Called when a post, page or media is deleted 
  465. * Don't delete translations if this is a post revision thanks to AndyDeGroo who catched this bug 
  466. * http://wordpress.org/support/topic/plugin-polylang-quick-edit-still-breaks-translation-linking-of-pages-in-072 
  467. * @since 0.1 
  468. * @param int $post_id 
  469. */ 
  470. public function delete_post( $post_id ) { 
  471. if ( ! wp_is_post_revision( $post_id ) ) { 
  472. $this->model->post->delete_translation( $post_id ); 
  473.  
  474. /** 
  475. * Filters the pages by language in the parent dropdown list in the page attributes metabox 
  476. * @since 0.6 
  477. * @param array $dropdown_args Arguments passed to wp_dropdown_pages 
  478. * @param object $post 
  479. * @return array Modified arguments 
  480. */ 
  481. public function page_attributes_dropdown_pages_args( $dropdown_args, $post ) { 
  482. $dropdown_args['lang'] = isset( $_POST['lang'] ) ? $this->model->get_language( $_POST['lang'] ) : $this->model->post->get_language( $post->ID ); // ajax or not ? 
  483. if ( ! $dropdown_args['lang'] ) { 
  484. $dropdown_args['lang'] = $this->pref_lang; 
  485.  
  486. return $dropdown_args;