WP HOOKS
akcjadynamicznyod 2.3.0

{$old_status}_to_{$new_status}

Args 1Plik wp-includes/post.php

Opis — z kodu źródłowego

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

The dynamic portions of the hook name, $new_status and $old_status, refer to the old and new post statuses, respectively. Possible hook names include:

  • draft_to_publish
  • publish_to_trash
  • pending_to_draft

Hook dynamiczny — możliwe nazwy

draft_to_publishpending_to_draftpublish_to_trash

Parametry

ParametrTypOpis
$post\WP_PostPost object.

Wywołanie

Rejestracja callbackaphp
// rejestracja funkcji zwrotnej
add_action( '{$old_status}_to_{$new_status}', 'twoja_funkcja' );

function twoja_funkcja($param_1) {
	// Twój kod
}

Popularne w tej kategorii