Viewing 1 replies (of 1 total)
  • Plugin Author Chouby

    (@chouby)

    Hi!

    I have planned to add the function below in v1.5.4

    /*
     * returns the post language
     *
     * @since 1.5.4
     *
     * @param int $post_id
     * @param string $field optional the language field to return 'name', 'locale', defaults to 'slug'
     * @return bool|string the requested field for the post language, false if no language is associated to that post
     */
    function pll_get_post_language($post_id, $field = 'slug') {
    	global $polylang;
    	return isset($polylang) && ($lang = $polylang->model->get_post_language($post_id)) ? $lang->$field : false;
    }
Viewing 1 replies (of 1 total)
  • The topic ‘Get language for a post’ is closed to new replies.