-
Notifications
You must be signed in to change notification settings - Fork 312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add new filter ep_skip_autosave_sync and enable autosave sync for protected_content feature #2861
Add new filter ep_skip_autosave_sync and enable autosave sync for protected_content feature #2861
Conversation
Hey @rebeccahum, I'm finally getting to this one. I like the idea of adding In addition to that, do you think it'd be possible to add some tests? End-to-end tests checking if that works as expected and also does not affect published posts is what I have in mind. Thanks! |
@felipeelia Done and done! |
@felipeelia Thanks for the feedback, I think I got it working now! |
Description of the Change
Problem: When a user has the
protected_content
feature enabled, and they work on a draft but they never hit "Save draft" and instead, rely on the WordPress autosave, it won't show up in the Draft post listing screen (/wp-admin/edit.php?post_status=draft&post_type=post):This is because it never gets synced, as we disable it here:
ElasticPress/includes/classes/Indexable/Post/SyncManager.php
Lines 284 to 289 in aaf2a33
This PR does two things:
ep_skip_autosave_sync
filterprotected_content
feature is enabledAlternate Designs
I'm not sure if it would be beneficial to pass in the
__FUNCTION__
for the second parameter duringapply_filters()
if one wanted to customize disabling the autosave sync on function-basis, since we haveaction_set_object_terms
,action_sync_on_update
, etc. to make it more granular:Curious on your thoughts @felipeelia for that.
Possible Drawbacks
N/A.
Verification Process
protected_content
feature/wp-admin/edit.php?post_status=draft&post_type=post
and expect to see the autosaved draftChecklist:
Changelog Entry
Fixed: autosaved drafts not showing up in draft post listing when using protected_content
Credits
Props @rebeccahum