Skip to content
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

Refactor post_updated and wp_insert_post callbacks #122

Open
ilicfilip opened this issue Nov 13, 2024 · 0 comments · May be fixed by #204
Open

Refactor post_updated and wp_insert_post callbacks #122

ilicfilip opened this issue Nov 13, 2024 · 0 comments · May be fixed by #204
Labels
enhancement New feature or request

Comments

@ilicfilip
Copy link
Collaborator

When post is published or updated we need to check if a new activity needs to be added, for that reason we hook into post_updated and wp_insert_post hooks and we have separate callbacks for them.

wp_insert_post is fired when post is inserted for the first time, but when post is updated both the post_updated and wp_insert_post are fired which makes both callbacks needlessly.

Quick fix would be to use the third parameter in the wp_insert_post ( (bool) $updated) and merge both callbacks in one function, something like this.

@ilicfilip ilicfilip added the enhancement New feature or request label Nov 13, 2024
@ilicfilip ilicfilip assigned aristath and jdevalk and unassigned jdevalk and aristath Nov 13, 2024
@ilicfilip ilicfilip linked a pull request Dec 27, 2024 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants