filtrdynamicznyod 5.8.0
wp_{$post->post_type}_revisions_to_keep
Args 2Plik wp-includes/revision.php
Opis — z kodu źródłowego
Filters the number of revisions to save for the given post by its post type.
Overrides both the value of WP_POST_REVISIONS and the {@see 'wp_revisions_to_keep'} filter.
The dynamic portion of the hook name, $post->post_type, refers to the post type slug.
Possible hook names include:
wp_post_revisions_to_keepwp_page_revisions_to_keep
Hook dynamiczny — możliwe nazwy
wp_page_revisions_to_keepwp_post_revisions_to_keepParametry
| Parametr | Typ | Opis |
|---|---|---|
$num | int | Number of revisions to store. |
$post | \WP_Post | Post object. |
Wywołanie
Rejestracja callbackaphp
// rejestracja funkcji zwrotnej — podaj liczbę argumentów!
add_filter( 'wp_{$post->post_type}_revisions_to_keep', 'twoja_funkcja', 10, 2 );
function twoja_funkcja($param_1, $param_2) {
// Twój kod
}
// rejestracja funkcji zwrotnej — podaj liczbę argumentów!
add_filter( 'wp_{$post->post_type}_revisions_to_keep', 'twoja_funkcja', 10, 2 );
function twoja_funkcja($param_1, $param_2) {
// Twój kod
}Popularne w tej kategorii