Black Friday Sale: up to 80% off every Pro plan

Ends Dec 15 at 6:59 pm EST. See pricing

Developer guide

Advanced

Written for Chat Help 3.8.2 and Chat Help Pro 3.8.2

Free Works in Chat Help Free and Pro.

This developer guide lists the filters you can use to change Chat Help from a theme or plugin.

How to use this developer guide #

Use a number from post meta #

chathelp_whatsapp_number filters the number of the floating chat. The context has post_id and type. This example uses a phone_number meta field on two post types and falls back to the chat’s number:

add_filter( 'chathelp_whatsapp_number', function ( $number, $context ) {
	if ( empty( $context['post_id'] ) ) {
		return $number;
	}
	if ( ! in_array( get_post_type( $context['post_id'] ), array( 'directory', 'product' ), true ) ) {
		return $number;
	}
	$meta = get_post_meta( $context['post_id'], 'phone_number', true );
	return $meta ? preg_replace( '/\D+/', '', $meta ) : $number;
}, 10, 2 );

Change the WhatsApp link #

chathelp_whatsapp_url filters the final link. The context has post_id, number, type and message.

add_filter( 'chathelp_whatsapp_url', function ( $url, $context ) {
	return add_query_arg( 'utm_source', 'chat-help', $url );
}, 10, 2 );

More filters #

  • chat_help_product_attributes_text ($text, $product, $parts, $values_only): the text of {productAttributes}.
  • chat_help_dashboard_capability and chat_help_leads_capability (default manage_options): who can see the dashboard and the leads.
  • chat_help_enqueue_desktop_qr ($enabled, $settings): turn the desktop QR code on or off in code.
  • chat_help_analytics_client_ip: the visitor IP used for rate limiting, for sites behind a proxy.
  • chat_help_analytics_limit_ip, chat_help_analytics_limit_session: tracking rate limits.

Developer guide: still have a question? Ask in the Chat Help forum on WordPress.org (opens in a new tab), or open a support ticket with Pro.

Was this article helpful?

Turn visitors into WhatsApp conversations

Start free from WordPress.org. Upgrade to Pro for team chat with several agents, the Advance button, dark mode, unlimited form fields, visibility rules and webhooks.

Chat Help Demo
ThemeAtelier
Typically replies within 1 minute.