Un motore di ricerca WordPress per sviluppatori e autori di temi

{$new_status}_{$post->post_type} ›

do_action( "{$new_status}_{$post->post_type}", $post->ID, $post )
Parametri: (2)
  • (int) $post_id Post ID.
  • (WP_Post) $post Post object.
Definito a:

Fires when a post is transitioned from one status to another.

The dynamic portions of the hook name, $new_status and $post->post_type, refer to the new post status and post type, respectively.

Please note: When this action is hooked using a particular post status (like 'publish', as publish_{$post->post_type}), it will fire both when a post is first transitioned to that status from something else, as well as upon subsequent post updates (old and new status are both the same).

Therefore, if you are looking to only fire a callback when a post is first transitioned to a status, use the {@see 'transition_post_status'} hook instead.


do_action( "{$new_status}_{$post->post_type}", $post->ID, $post );