Skip to content
Docs
Get RestroPress

Filter

rpress_pie_graph_output

Updated
On this page

Filters the HTML and script output of a pie graph.

Runs when RPRESS_Pie_Graph builds its markup, after the chart script and containers are rendered into a buffer. The output is only built when the graph has data. The result is later passed through wp_kses by display(), which allows only script and div tags with limited attributes.

Parameters#

ParameterTypeDescription
$outputstringThe rendered script and container markup.
$graph_idstringThe unique ID generated for this graph.
$dataarrayThe label => value data being plotted.
$optionsarrayThe pie graph options after defaults are applied.

Return value#

string. The markup to print.

Example#

function my_pie_graph_output( $output, $graph_id, $data, $options ) {
	return $output . '<div id="my-pie-note-' . esc_attr( $graph_id ) . '" class="my-pie-note"></div>';
}
add_filter( 'rpress_pie_graph_output', 'my_pie_graph_output', 10, 4 );

Source#

Applied in:

  • includes/admin/reporting/class-rpress-pie-graph.php (line 158), in RPRESS_Pie_Graph::build_graph()

See also#

Was this page helpful?