deleted items still showing in suggestions
- ali.h@sela.aeParticipant2 years, 3 months ago #29808
Hello Team,
when deleting items from woocommerce via
wp_delete_post($id)
OR
$product = wc_get_product($id);
$product->delete();
The items still show in the suggestions dropdown without image or link, but it doesn’t show in search page.
- This topic was modified 2 years, 3 months ago by wpsolr.
ali.h@sela.aeParticipant2 years, 3 months ago #29810Yes it is still in the index.
Here is the screenshot of the response of a direct call to elastic search.
wpsolrKeymaster2 years, 3 months ago #29811WPSOLR removes a post from the index when the WP ‘save_post’ hook is sent, for instance when a post is trashed.
But I just noticed that wp_delete_post() does not send the hook ‘save_post’.
To fix this issue, the hook ‘after_delete_post’ will be added on next WPSOLR release.For now, you could trash the product before deleting it to remove it from the index.
Or change line 116 of file /wpsolr-pro/wpsolr/core/wpsolr_include.inc.php :
add_action( 'save_post', 'add_remove_document_to_solr_index', 999, 3 );
with:
add_action( 'save_post', 'add_remove_document_to_solr_index', 999, 3 ); do_action( 'after_delete_post', 'add_remove_document_to_solr_index', 10, 2 );
- This reply was modified 2 years, 3 months ago by wpsolr.
ali.h@sela.aeParticipant2 years, 3 months ago #29813Thank you
ali.h@sela.aeParticipant2 years, 3 months ago #29815Hello Support
This fix did not resolve the issue.
Please help urgently we cannot delete the index every bit and reindex again, we have more than 500k items.ali.h@sela.aeParticipant2 years, 3 months ago #29861Additionally, even when a product is deleted or trashed from the dashboard, it does not get removed from the index.
ali.h@sela.aeParticipant2 years, 3 months ago #29863No, it was there even before.
ali.h@sela.aeParticipant2 years, 3 months ago #29864There is another issue we also noticed when we first installed the plugin.
we are using Dokan with woocommerce, when we disable a vendor, their products do not get removed from the index also. but I will open a separate thread for this as I need the check the status of products when the vendor is disabledali.h@sela.aeParticipant2 years, 3 months ago #29866Ok, what about the deleted items issue?
ali.h@sela.aeParticipant2 years, 3 months ago #29870But delete is done from Woocommerce dashboard, and we are using WordPress’s (wp_delete_post and wp_trash_post) and Woocommerce’s ($product->delete()) core functionalities to delete products and it is not working
You must be logged in to reply to this topic.