WP HOOKS
filtrdynamicznyod 4.7.0

rest_{$this->post_type}_trashable

Args 2Plik wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php

Opis — z kodu źródłowego

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.

Hook dynamiczny — możliwe nazwy

rest_attachment_trashablerest_page_trashablerest_post_trashable

Parametry

ParametrTypOpis
$supports_trashboolWhether the post type support trashing.
$post\WP_PostThe Post object being considered for trashing support.

Wywołanie

Rejestracja callbackaphp
// rejestracja funkcji zwrotnej — podaj liczbę argumentów!
add_filter( 'rest_{$this->post_type}_trashable', 'twoja_funkcja', 10, 2 );

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

Popularne w tej kategorii