Quantcast
Viewing all articles
Browse latest Browse all 11471

joschi81 on "[Plugin: Polylang] Setting post language via custom post form"

I did it like this (within my functions.php):

do_action('wp_insert_post', 'wp_insert_post');
global $polylang;
$lang = pll_current_language();
if(method_exists($polylang,'set_post_language')) $polylang->set_post_language($current_post_id, isset($lang) ? $lang : $this->get_preferred_language());

@Chouby: Wouldn't it be great to hook into the wp_insert_post action and set the language of new posts automatically, even if they are posted via a frontend form?


Viewing all articles
Browse latest Browse all 11471

Trending Articles



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