Back to Filters

Updated on Jun 15, 2024


WP Slimstat allows you to customize the reports available in the plugin. You can add, remove, or edit reports using a simple API. This document explains how to use this feature.


WP Slimstat stores report information in an array called self::$reports_info. You can modify this array using the slimstat_reports_info filter.

self::$reports_info = apply_filters( 'slimstat_reports_info', self::$reports_info );

Report Structure

Each report is defined as an array with specific keys:

  1. title: The title of the report (string).
  2. callback: The function to render the report (string or array).
  3. callback_args: Arguments for the callback function (array).
  4. raw: Function to retrieve data from the database.
  5. classes: CSS classes for layout (array of strings).
    • Options: ‘normal’, ‘wide’, ‘full-width’, ‘tall’.
  6. screens: Where the report appears (array of strings).
    • Options: ‘wp-slim-view-1’ to ‘wp-slim-view-6’, ‘dashboard’.
  7. tooltip (optional): Tooltip text for the report (string).

Example: Adding a Custom Report

Use the slimstat_reports_info filter to add your custom report:

add_filter('slimstat_reports_info', 'add_custom_report');

function add_custom_report($reports_info) {
    $reports_info['slim_custom_report'] = array(
        'title' => 'My Custom Report',
        'callback' => 'raw_results_to_html',
        'callback_args' => array(
            'raw' => 'get_custom_data'
        'classes' => array('full-width'),
        'screens' => array('wp-slim-view-3')

    return $reports_info;

In this example

  • slim_custom_report is the unique ID for your report.
  • raw_results_to_html is a WP Slimstat function that renders data.
  • get_custom_data is your custom function to fetch data.

Important Notes

  1. Use unique IDs for your custom reports to avoid conflicts with built-in reports.
  2. The raw function in callback_args is used for Excel exports and email functionality.
  3. You can mix and match classes (e.g., array(‘normal’, ‘tall’)).
  4. Place your report in appropriate screens based on its content.

By following these guidelines, you can easily add, customize, or remove reports in WP Slimstat to suit your needs