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 | |
// Use `supplemental` Engine for Divi Search Results Templates. | |
// @link https://searchwp.com/documentation/knowledge-base/divi/ | |
add_filter( 'searchwp\integration\pagebuilder\engine', function( $engine, $params ) { | |
if ( 'divi' === $params['context'] ) { | |
$engine = 'supplemental'; | |
} | |
return $engine; |
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 | |
// Disable automatic block parsing during SearchWP index. | |
add_filter( 'searchwp\source\post\attributes\content\do_blocks', '__return_false' ); | |
// SearchWP custom Block parser. | |
add_filter( 'searchwp\source\post\attributes\content', function( $content, $args ) { | |
if ( 'post' === $args['post']->post_type ) { | |
// This will hold the content we want to index for this Post. | |
$content_to_index = ''; |
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 | |
// Customize SearchWP's Indexer throttle. | |
add_filter( 'searchwp\background_process\load_throttle', | |
function( $throttle, $args ) { | |
return 4 * $args['load']; | |
}, | |
10, 2 ); |
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 | |
// Increase SearchWP's load maximum threshold to allow loads up to 4 instead of 2. | |
// @link https://searchwp.com/documentation/hooks/searchwp-background_process-load_maximum/ | |
add_filter( 'searchwp\background_process\load_maximum', function( $max ) { | |
return 4; | |
} ); |
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 | |
// Disable SearchWP system load monitoring. | |
add_filter( 'searchwp\background_process\load_monitoring', '__return_false' ); |
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 | |
// Provide HTTP Basic Authentication credentials to SearchWP (and WP Cron). | |
class MySearchWPBasicAuthCreds { | |
private $username = 'username'; // HTTP Basic Auth username. | |
private $password = 'password'; // HTTP Basic Auth password. | |
function __construct() { | |
// Provide HTTP Basic Authentication credentials to SearchWP. | |
add_filter( |
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 | |
// Customize the SearchWP Query arguments used for REST requests. | |
add_filter( 'searchwp\rest\args', function( $args, $params ) { | |
// $args are sent to \SWP_Query after this. | |
// @link https://searchwp.com/documentation/classes/swp_query/ | |
return $args; | |
}, 10, 2 ); |
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 | |
// Customize the SearchWP Engine used for applicable REST requests. | |
add_filter( 'searchwp\rest\engine', function( $engine, $args ) { | |
return 'my_rest_engine_name'; | |
}, 10, 2 ); |
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 | |
// Disable default SearchWP REST API Integration. | |
add_filter( 'searchwp\rest', '__return_false' ); |
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
# wp_searchwp_tokens already has a primary key. | |
ALTER TABLE `wp_searchwp_index` ADD COLUMN `indexid` BIGINT(20) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT FIRST; | |
ALTER TABLE `wp_searchwp_log` ADD COLUMN `logid` BIGINT(20) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT FIRST; | |
ALTER TABLE `wp_searchwp_status` CHANGE `site` `site` BIGINT(20) unsigned NOT NULL COMMENT 'Site ID'; | |
ALTER TABLE `wp_searchwp_status` ADD COLUMN `statusid` BIGINT(20) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT FIRST; |