filtrod 5.9.0
is_post_type_viewable
Opis — z kodu źródłowego
Filters whether a post type is considered "viewable".
The returned filtered value must be a boolean type to ensure is_post_type_viewable() only returns a boolean. This strictness is by design to maintain backwards-compatibility and guard against potential type errors in PHP 8.1+. Non-boolean values (even falsey and truthy values) will result in the function returning false.
Parametry
| Parametr | Typ | Opis |
|---|---|---|
$is_viewable | bool | Whether the post type is "viewable" (strict type). |
$post_type | \WP_Post_Type | Post type object. |
Wywołanie
Rejestracja callbackaphp
// rejestracja funkcji zwrotnej — podaj liczbę argumentów!
add_filter( 'is_post_type_viewable', 'twoja_funkcja', 10, 2 );
function twoja_funkcja($param_1, $param_2) {
// Twój kod
}
// rejestracja funkcji zwrotnej — podaj liczbę argumentów!
add_filter( 'is_post_type_viewable', 'twoja_funkcja', 10, 2 );
function twoja_funkcja($param_1, $param_2) {
// Twój kod
}Popularne w tej kategorii