Created
March 26, 2020 21:42
-
-
Save bchiang7/f0eb94b297bae5108426e2c6c00c731a to your computer and use it in GitHub Desktop.
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 | |
public function set_config($args, $assoc_args) { | |
global $algolia; | |
$canonical_index_name = apply_filters('algolia_index_name', 'global_search'); | |
$index = $algolia->initIndex($canonical_index_name); | |
// Set index settings if '--settings' flag exists | |
if (isset($assoc_args['settings'])) { | |
$settings = (array) apply_filters('algolia_get_settings', $index_name, []); | |
if ($settings) { | |
$index->setSettings($settings); | |
WP_CLI::success('Pushed settings to '.$index->getIndexName()); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment