You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After the term deletion, it should not be returned anymore.
Additional context
It seems we are trying to delete the term too late. So, when the code hits the current_user_can( 'delete_term', $term_id ) check inside ElasticPress\Indexable\Term\SyncManager::action_sync_on_delete() (here), the term does not exist anymore and current_user_can returns false.
Changing add_action( 'delete_term', [ $this, 'action_sync_on_delete' ] );
to add_action( 'pre_delete_term', [ $this, 'action_sync_on_delete' ] );
fixes the issue.
The text was updated successfully, but these errors were encountered:
Describe the bug
Currently, if you delete a term, it will not be removed from the ES index, requiring a full re-index to sync terms again.
Steps to Reproduce
Test Term
header.php
, for debug purposes:[name] => Test Term
[name] => Test Term
still thereExpected behavior
After the term deletion, it should not be returned anymore.
Additional context
It seems we are trying to delete the term too late. So, when the code hits the
current_user_can( 'delete_term', $term_id )
check insideElasticPress\Indexable\Term\SyncManager::action_sync_on_delete()
(here), the term does not exist anymore and current_user_can returns false.Changing
add_action( 'delete_term', [ $this, 'action_sync_on_delete' ] );
to
add_action( 'pre_delete_term', [ $this, 'action_sync_on_delete' ] );
fixes the issue.
The text was updated successfully, but these errors were encountered: