wp_untrash_post_status

FILTER wp-includes\post.php (ligne 4150) github
Filters the status that a post gets assigned when it is restored from the trash (untrashed). By default posts that are restored will be assigned a status of 'draft'. Return the value of `$previous_status` in order to assign the status that the post had before it was trashed. The `wp_untrash_post_set_previous_status()`

Paramètres

Entrée :
$new_status, $post_id, $previous_status
Sortie :
@param string $new_status      The new status of the post being restored.
@param int    $post_id         The ID of the post being restored.
@param string $previous_status The status of the post at the point where it was trashed.

Utilisation

// Modifier la valeur avec le filtre 'wp_untrash_post_status'
add_filter('wp_untrash_post_status', 'ma_fonction_filtre', 10, 1);

function ma_fonction_filtre($new_status) {
    // Modifier la valeur
    return $new_status;
}

Actualités

Chargement des actualités...