humanmade / elasticpress-stopwords
WordPress plugin to integrate WordPress stopwords with ElasticPress mapping.
Installs: 2 795
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 21
Forks: 1
Open Issues: 1
Type:wordpress-plugin
Requires
- composer/installers: ~1.0
This package is auto-updated.
Last update: 2024-10-23 06:20:25 UTC
README
ElasticPress stopwords allows developers to customize stopwords functionality of Elastic through linking ElasticPress mapping with WordPress default stopwords list and using related filter wp_search_stopwords
.
Requirements
- PHP >= 7.1
- WordPress >= 5.3
- ElasticPress >= 3.4.3 (not tested with older versions)
Getting Set Up
Install Using Composer
composer require humanmade/elasticpress-stopwords
Load the plugin
require_once __DIR__ . '/vendor/humanmmade/elastic-stopwords/plugin.php';
Once you've installed the plugin, use the following code to manage stopwords:
add_filter( 'wp_search_stopwords', function( array $stopwords ) : array { $words_to_remove = [ 'foo' ]; $words_to_add = [ 'bar' ]; return array_merge( array_diff( $stopwords, $words_to_remove ), $words_to_add ); } );
Credits
Created by Human Made with ❤️
Written and maintained by Shady Sharaf.
Interested in joining in on the fun? Join us, and become human!