Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

Luke Janicke on "“publish_post” action hook shouldn’t be depreciated! Why is it?"

$
0
0

On the Action Reference page, publish_post is listed as depreciated. Likewise on the publish_post page itself. It is said to have been depreciated since Version 2.3.

However...

On the new Post Status Transitions page there are three NEW kinds of action hooks.

  1. {$old_status}_to_{$new_status} (using the statuses below)
  2. transition_post_status (a generic action hook that fires on every transition)
  3. status_object (e.g. publish_post)

Statuses

  • new
  • publish
  • pending
  • draft
  • auto-draft
  • future
  • private
  • inherit
  • trash

So, according to all this publish_post should still be a legitimate action hook!

I want to use it! In fact, I also want to use pending_post and future_post.

If I don’t use these, I have to use multiple action hooks to accommodate every possible $old_status that a post may come from. publish_post is a useful action hook that fires every time a post status is changed to publish, irrespective on whether it was previously new, draft, auto_draft, pending, or future.

What’s the deal?


Viewing all articles
Browse latest Browse all 8245

Trending Articles