Created
February 1, 2023 03:41
-
-
Save dlh01/21ed95b93d188b8ee23110a494a6b45d to your computer and use it in GitHub Desktop.
Elasticsearch Extensions example
This file contains 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 | |
add_action( | |
'elasticsearch_extensions_config', | |
function ( $es_config ) { | |
$es_config | |
->restrict_post_types( [ 'post', 'page' ] ) | |
->enable_empty_search() | |
->enable_post_type_aggregation() | |
->enable_taxonomy_aggregation( 'category' ) | |
->enable_taxonomy_aggregation( 'post_tag' ); | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment