SearchWP Documentation

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

searchwp\index\rebuild

Since: 4.0.0

Table of Contents

This action is fired any time the Index is reset, just prior to the rebuilding job is triggered.

Parameters

There are no parameters for this hook.

Examples

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

Send an email when the index is reset

Send an email to the site administrator when the Index is reset

<?php
// Send an email to the site adminstrator when the SearchWP Index is reset.
add_action( 'searchwp\index\rebuild', function() {
wp_mail(
get_option( 'admin_email' ),
'SearchWP Index Reset',
'The SearchWP Index has been reset.'
);
} );

How to use this code