WP All Import
Automatically trigger re-indexing
FacetWP doesn’t automatically index content added via the WP All Import plugin.
Fortunately, the hooks below can be used that allow FacetWP to automatically detect and index imported content.
<?php
function fwp_reindex_post( $post_id ) {
if ( function_exists( 'FWP' ) ) {
FWP()->indexer->index( $post_id );
}
}
add_action( 'pmxi_saved_post', 'fwp_reindex_post' );
The above filter re-indexes individual posts. If you’re importing large datasets and would rather re-index the entire site, use the following instead:
<?php
function fwp_import_posts( $import_id ) {
if ( function_exists( 'FWP' ) ) {
FWP()->indexer->index();
}
}
add_action( 'pmxi_after_xml_import', 'fwp_import_posts' );
Add this code to your theme’s functions.php
or within our Custom Hooks add-on.