Highcharts PHP Hooks & Filters
These hooks are provided by the M Chart Highcharts Library plugin. Several core M Chart hooks also fire during Highcharts output — those are covered at the end of this page under Shared core hooks.
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.langsettings)$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 tofalse$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 tofalse$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.
Shared Core Hooks
These hooks are defined by core M Chart, but the Highcharts Library fires them from its own render path, so they work when Highcharts is the active library. See PHP Hooks & Filters for the full reference on each.
m_chart_chart_args
Filters the final chart configuration array just before it is passed to Highcharts.chart(). This is the most powerful customization point for Highcharts output — anything Highcharts accepts as configuration can be set here.
add_filter( 'm_chart_chart_args', function( $chart_args, $post, $post_meta, $args ) {
$chart_args['plotOptions']['series']['animation'] = false;
return $chart_args;
}, 10, 4 );
Parameters:
$chart_args(array) — The full Highcharts configuration array$post(WP_Post) — The chart post object$post_meta(array) — The chart post meta$args(array) — Display arguments
m_chart_after_chart_args
Fires inside the front-end inline <script> immediately after the chartArgs JavaScript variable is emitted and before the chart renders. Use it to output JS that mutates chartArgs pre-render — this is the complement to m_chart_post_render_javascript, which runs after rendering inside the render callback.
Parameters: $post_id (int), $args (array), $instance (int)
m_chart_screen_reader_text
Fires inside the screen-reader-only description container after the accessible data table, letting you append extra context for assistive technology. Same behavior as the core hook.
Parameters: $post_id (int), $args (array)
m_chart_defer_rendering_observer_options
Filters the IntersectionObserver options (rootMargin, threshold) used when the Defer Rendering setting is enabled, controlling how early below-the-fold Highcharts charts start rendering as the visitor scrolls.
Parameters: $options (array), $post_id (int), $args (array)