-
Notifications
You must be signed in to change notification settings - Fork 39
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
before_delete_post More Information: unclear, inaccurate #115
Comments
Thank you @TonyGravagno. I'd suggest just one thing to enhance readability - let's split the list into when the is running and when not.
I'll leave this to self-assigned @stevenlin-x 🙌 |
I've revised the Explanation section. |
Thank you @TonyGravagno and @stevenlin-x ❤️ @TonyGravagno can you please give me your WordPress.org username. I can't find you there and really want to give you a "contributor" badge :) |
I am WP |
@TonyGravagno since you're not on WordPress slack I have to ask you here. Can you please go to this URL while logged in and request membership? Sorry there's no more elegant way to give you recognition for your contributions. Thank you ❤️ |
Done. Thanks! |
Take a look at your profile 🙌 |
I am SOOOOOOOOOO honored. TYVM ... and now on to actually earning those creds... |
Issue Description
Developer note for action
before_delete_post
is not clear, slightly incorrect, and can be misleading. I think it's just time to refresh that text.URL of the Page with the Issue
https://developer.wordpress.org/reference/hooks/before_delete_post/
Section of Page with the issue
More Information
Why is this a problem?
The first statement "the hook runs only when the WordPress user empties the Trash" does not account for forced deletion. The action is run when trash is disabled and an item is deleted, unrelated to emptying trash, ref 5.8.1 source.
Further, trash is not just deleted by a WordPress user - items can be removed automatically as well based on scheduling.
The phrase 'force deleted' is used but it's not clear what this means.
The suggestion to use the delete_post hook is incorrect. Yes, that hook is executed in the cycle of removing an attachment, but not in the same place in the cycle as
before_delete_post
. For this equivalent we havedelete_attachment
, and for trash it'swp_trash_post
.I believe it would help a developer to get a brief insight into the trash mechanism while looking at these relevant comments.
Suggested Fix
Replace the paragraph with the following:
Ref do_action in wp_trash_post() and function wp_delete_attachment().
The text was updated successfully, but these errors were encountered: