ElasticPress
ElasticPress copied to clipboard
Add filter to bypass the Delete/Update Term permission check in SyncManager
Description of the Change
This change will add a hook to override the permission check when deleting/updating terms. This feature already exists in the Post SyncManager when deleting and updating.
Alternate Designs
This code will mirror how it's currently done in the Post SyncManager but the code could be expanded to include the DOING_CRON
conditions in the delete action for both term and post so the logic is more similar. It could be argued to be outside this scope since the current/initial PR suggestion will simply add opt-in features whereas adding CRON conditions changes default behavior.
Benefits
Allows developers to bypass the user permission check for operations that happens outside logged in environments (CLI etc).
Possible Drawbacks
Could allow for developers to create their own "vulnerability" so others can delete/updating terms without user permission but is not inherently true by default. I'm guessing this is not something you're too worried about (like me) since it already exists in the Post SyncManager.
Verification Process
Checklist:
- [x] I have read the CONTRIBUTING document.
- [x] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] I have added tests to cover my change.
- [ ] All new and existing tests passed.
Applicable Issues
Changelog Entry
Added filter to bypass user permission check before deleting/updating terms from index.