rest_page_trashable filter-hookWP 4.7.0

Filters whether a post is trashable.

Pass false to disable Trash support for the post.

This is one of the variants of the dynamic hook rest_(post_type)_trashable

Usage

add_filter( 'rest_page_trashable', 'wp_kama_rest_page_trashable_filter', 10, 2 );

/**
 * Function for `rest_page_trashable` filter-hook.
 * 
 * @param bool    $supports_trash Whether the post type support trashing.
 * @param WP_Post $post           The Post object being considered for trashing support.
 *
 * @return bool
 */
function wp_kama_rest_page_trashable_filter( $supports_trash, $post ){

	// filter...
	return $supports_trash;
}
$supports_trash(true|false)
Whether the post type support trashing.
$post(WP_Post)
The Post object being considered for trashing support.

Changelog

Since 4.7.0 Introduced.

Where the hook is called

WP_REST_Posts_Controller::delete_item()
rest_page_trashable
wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php 974
$supports_trash = apply_filters( "rest_{$this->post_type}_trashable", $supports_trash, $post );

Where the hook is used in WordPress

Usage not found.