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

karimit on "[Plugin: Polylang] Setting default language for custom post types"

$
0
0

I just added the following action, and Problem Solved:

function update_post_language( $post_id ) {
	$post_type = get_post_type($post_id);
	if ($post_type == 'dwqa-question' || $post_type == 'dwqa-answer') {
		$term = term_exists('ar', 'language');
		if ($term !== 0 && $term !== null) {
			wp_set_post_terms( $post_id, array ('ar'), 'language', true );
		}
	}
}
add_action( 'save_post', 'update_post_language' );

Thanks again :)


Viewing all articles
Browse latest Browse all 11471

Trending Articles



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