SearchWP Documentation

View the installation guide, browse the Knowledge Base, find out about SearchWP’s many hooks

searchwp\admin\dashboard_widgets\statistics\days

Since: 4.0.0

Table of Contents

By default the Statistics Dashboard Widget shows popular searches over the past 30 days. Use this hook to modify that default.

Parameters

Type Parameter Default Since
Integer $days 30 4.0.0

Examples

All hooks should be added to your custom SearchWP Customizations Plugin.

Change the time frame considered for Dashboard Widget Statistics to 7 days

<?php
// Consider 7 days instead of 30 when displaying Statistics Dashboard Widget.
add_filter( 'searchwp\admin\dashboard_widgets\statistics\days', function( $days ) {
return 7;
} );

How to use this code