algolia / algoliasearch-wordpress

❌🗑🙅‍♂️ Algolia Search plugin for WordPress is no longer supported. Please use our API client guide instead
https://www.algolia.com/doc/integration/wordpress/getting-started/quick-start/
GNU General Public License v2.0
358 stars 114 forks source link

feat: add algolia_clear_index_if_existing filter #820

Closed sebastianthulin closed 5 years ago

sebastianthulin commented 5 years ago

A part of bringing multisite support to algolia wordpress: Allows a developer to turn of automatic index truncating. This is required to prevent a site from erasing other sites data.

Previously discussed here: https://github.com/algolia/algoliasearch-wordpress/pull/745

sebastianthulin commented 5 years ago

Hi! Is it possible to get this merged until next week? I would love to see that, to avoid to make a new fork for my specific use.

MWDelaney commented 5 years ago

I have spent my entire morning basically looking for this feature so that I could combine multiple sites into a single index.

For reference by anyone else finding this (and for some SEO value) this fix lets you combine results from multiple WordPress sites into a single Algolia index. Again, for Google, this can allow cross-site, or multiple site search for Algolia and WordPress.

Referenced from the previous PR, too, here's the filter you'd use to disable clearing of the index:

add_filter('algolia_clear_index_if_existing', function ($state) {
    return false;
});
sebastianthulin commented 5 years ago

@rayrutjes Any progress on this?

rayrutjes commented 5 years ago

Thanks a lot for your active participation in this plugin. We wanted to let you know that we chose to go in another direction regarding the way we integrate Algolia to WordPress. More information can be found here.