1

For plugin development if I intend to update a post outside of the query and after so many days based on a category what is the appropriate hook to use?

Through research from the query "wp modify post hook" I get first result of Plugin API/Action Reference with a list of actions run during a request but I'm stuck on which to use:

  • pre_get_posts : This hook is called after the query variable object is created, but before the actual query is run I only intend to update the categories and the loop will never be called so is this the best approach?
  • edit_post : Fires once an existing post has been updated. Not much listed but I'm looking for the posts that fit the above parameters and this states after it's been updated.

Through SE sites I see:

So which hook should I use to manipulate a post outside of the query based on if a post has a category?

4
  • How do you plan to update the post? I've read your question twice and don't know when or where you will update it.
    – Johansson
    Commented Jun 13, 2017 at 14:51
  • It's related to this question that I'm trying to understand where I'm manipulating but I keep getting overwhelmed in the documentation.
    – user9447
    Commented Jun 13, 2017 at 14:53
  • @DᴀʀᴛʜVᴀᴅᴇʀ you can simply use wp_update_post() function instead of hooks. Refer Codex site for wp_update_post details. Commented Jun 13, 2017 at 14:57
  • Then I guess I'm misunderstanding my issue in my other question. I thought my issue was with the hook since I get an error when I go look at any post I've tried to modify.
    – user9447
    Commented Jun 13, 2017 at 15:04

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.