Polylang Post Language rules

You are here:
< All Topics

In order to use Polyang post language rules to send a post in specific language to a specific channel/group on Telegram, you can make use of the custom code as below:

After you add the code, you can the Post Language rule in instance settings.

We recommend My Custom Functions plugin to add the code safely. Otherwise, you can add the code to functions.php of your child theme.

/* PHP >= 5.6 */
/**
 * Register the Post Language rule type to display in
 * instance rules dropdown
 */
add_filter(
	'wptelegram_pro_p2tg_rule_types',
	function ( $rule_types ) {
		$rule_types[] = array(
			'label'   => __('Polylang', 'text-domain'),
			'options' => array(
				array(
					'value' => 'tax:language',
					'label' => __('Post Language',  'text-domain'),
				),
			),
		);
		return $rule_types;
	}
);
Previous Additional Media
Next Template conditional logic
Table of Contents

Ready to dive in? Buy NOW