M ChartM Chart
Users
Pro
Highcharts
Developers
Download
GitHub
Users
Pro
Highcharts
Developers
Download
GitHub
  • Highcharts

    • Highcharts Guide
    • Highcharts Themes
    • Highcharts PHP Hooks & Filters
    • Highcharts Admin UI Hooks
    • Highcharts JavaScript Events

Highcharts PHP Hooks & Filters

These hooks are provided by the M Chart Highcharts Library plugin.

Action Hooks

m_chart_post_render_javascript

Fires inside the Highcharts render callback after the chart has finished rendering. Use this to inject inline JavaScript that runs in the context of the rendered Highcharts chart object.

add_action( 'm_chart_post_render_javascript', function( $post_id, $args, $instance ) {
	// Inline JS runs in the Highcharts render callback
	echo 'console.log("Chart rendered:", chart);';
}, 10, 3 );

Parameters:

  • $post_id (int) — The chart post ID
  • $args (array) — Display arguments
  • $instance (int) — The chart instance number

Filter Hooks

m_chart_chart_options

Filters the Highcharts chart options array. Use this to modify chart configuration for localization or other customizations.

add_filter( 'm_chart_chart_options', function( $options, $library ) {
	$options['lang']['decimalPoint'] = ',';
	return $options;
}, 10, 2 );

Parameters:

  • $options (array) — The Highcharts wide options (e.g. lang settings)
  • $library (string) — The active library slug ('highcharts')

m_chart_enable_highcharts_accessibility

Available since version 1.2.3. Filters whether the Highcharts accessibility module is loaded. The module is disabled by default — return true to enable it.

add_filter( 'm_chart_enable_highcharts_accessibility', '__return_true' );

Parameters:

  • $enabled (bool) — Whether the module should load; defaults to false
  • $post_id (int) — The chart post ID
  • $context (string) — '' on regular pages, 'iframe' when the chart renders inside an iframe embed

m_chart_enable_highcharts_export

Available since version 1.2.3. Filters whether the Highcharts export module is loaded. The module is disabled by default — return true to enable the export/download button.

add_filter( 'm_chart_enable_highcharts_export', '__return_true' );

Parameters:

  • $enabled (bool) — Whether the module should load; defaults to false
  • $post_id (int) — The chart post ID
  • $context (string) — '' on regular pages, 'iframe' when the chart renders inside an iframe embed

m_chart_highcharts_available_themes

Available since version 1.2.3. Filters the array of available Highcharts themes. Use this to add, remove, or modify themes programmatically.

The array is keyed by theme filename; each value is an object with slug, name, file, and options properties.

add_filter( 'm_chart_highcharts_available_themes', function( $themes ) {
	// Remove a built-in theme
	unset( $themes['legacy-v3.php'] );
	return $themes;
} );

A second filter, m_chart_highcharts_themes, runs immediately afterwards with the same array — hooking either one works.

See Highcharts Themes for information on creating custom themes.

Last Updated: 6/11/26, 1:26 AM
Contributors: Jamie Poitra
Prev
Highcharts Themes
Next
Highcharts Admin UI Hooks