Back to Filters

Updated on Jun 10, 2024

slimstat_get_var_sql

The slimstat_get_var_sql filter allows you to modify the SQL query that retrieves a single aggregated value from the WP Slimstat database.

Usage

$_sql = apply_filters( 'slimstat_get_var_sql', $_sql, $_aggregate_value );

Parameters

  • $_sql (string): The original SQL query string that WP Slimstat uses to fetch the aggregated value.
  • $_aggregate_value (string): The value to be retrieved from the database.

How to Use

  1. Hook into the slimstat_get_var_sql filter to customize the SQL query.
  2. Return the modified SQL statement.

Example Usage

Here’s an example of how you can use this filter:

add_filter( 'slimstat_get_var_sql', 'modify_slimstat_sql', 10, 2 );

function modify_slimstat_sql( $sql, $aggregate_value ) {
    // Your custom SQL modifications here
    return $sql;
}

In this example, the modify_slimstat_sql function allows you to change the SQL query before it runs.