Available since: 1.6
searchwp_background_deltas
SearchWP automatically maintains it’s index by performing delta updates when content is added, edited, or removed. If you have a high traffic website you may want to offload this behavior to a custom WP-Cron job.
The difference between this hook and searchwp_auto_reindex
is that this hook prevents both purging and re-indexing of posts. searchwp_auto_reindex
allows for posts to be purged on edit, but not reindexed.
Example: To prevent SearchWP from automatically performing delta updates, add the following to your active theme’s functions.php
:
<?php | |
// prevent SearchWP from automatically maintaining it's index | |
add_filter( 'searchwp_background_deltas', '__return_false' ); |
Note that if you disable automatic index updates, you will need to periodically tell SearchWP to update it’s index. You can do so by setting up a custom WP-Cron job or something similar, but the important part is to ensure you fire the following:
<?php | |
// Manually process flagged index updates | |
if( function_exists( 'SWP' ) ) { | |
SWP()->process_updates(); | |
} |