SearchWP Documentation

インストールガイドを表示したり、ナレッジベースを参照したり、SearchWPの多くのフックについて確認したりできます。

searchwp\integration\wp-all-import

提供開始: 4.1.16

デフォルトでは、SearchWPは、コンテンツのインポート/移行との統合方法で説明されている方法に従って、WP All Importによって実行されるプロセスに自動的に対応します。

このフックを使用して、独自の実装を希望する場合に、SearchWPがWP All Importプロセスと自動的に統合するのを防止できます。

パラメータ

タイプ パラメータ デフォルト 提供開始
ブール値 $enabled WP All Importがアクティブかどうか 4.1.16

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

WP All ImportとのSearchWP自動統合を無効にし、独自のものを使用する

このスニペットは、WP All ImportプロセスとのSearchWPの自動統合を無効にするための基本事項の概要を示し、独自の実装方法の基本を示しています。

<?php
// Disable SearchWP's automatic integration with WP All Import.
add_filter( 'searchwp\integration\wp-all-import', '__return_false' );
add_action( 'pmxi_before_xml_import', function( $import_id ) {
\SearchWP::$indexer->pause();
}, 10 );
add_action( 'pmxi_saved_post', function( $post_id ) {
$source_name = \SearchWP\Utils::get_post_type_source_name( get_post_type( $post_id ) );
$source = \SearchWP::$index->get_source_by_name( $source_name );
// Mark this to be dropped after the import has finished.
\SearchWP::$index->drop( $source, $post_id );
}, 10 );
add_action( 'pmxi_after_xml_import', function( $import_id ) {
\SearchWP::$indexer->unpause();
// Process all entries marked to be dropped.
\SearchWP::$index->unpause();
\SearchWP::$index->trigger();
}, 10 );

このコードの使用方法