rest_{$this->post_type}_trashable

FILTER wp-includes\rest-api\endpoints\class-wp-rest-posts-controller.php (ligne 1120) github
Filters whether a post is trashable. The dynamic portion of the hook name, `$this->post_type`, refers to the post type slug. Possible hook names include:  - `rest_post_trashable`  - `rest_page_trashable`  - `rest_attachment_trashable` Pass false to disable Trash support for the post.

Paramètres

Entrée :
$supports_trash, $post
Sortie :
@param bool    $supports_trash Whether the post type support trashing.
@param WP_Post $post           The Post object being considered for trashing support.

Utilisation

// Modifier la valeur avec le filtre 'rest_{$this->post_type}_trashable'
add_filter('rest_{$this->post_type}_trashable', 'ma_fonction_filtre', 10, 1);

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

Actualités

Chargement des actualités...