Created
September 28, 2017 15:35
-
-
Save rayrutjes/70eb29158234e893700c9c414b5dcdc4 to your computer and use it in GitHub Desktop.
Programmatic re-indexing index WordPress Algolia plugin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$algolia = Algolia_Plugin::get_instance(); | |
$index = $algolia->get_index('posts_product'); | |
$total_pages = $index->get_re_index_max_num_pages(); | |
if ( $total_pages === 0 ) { | |
$index->re_index( 1 ); | |
return; | |
} | |
$page = 1; | |
do { | |
$index->re_index( $page++ ); | |
} while ( $page <= $total_pages ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment