apply_filters( 'is_protected_meta', bool $protected , string $meta_key , string|null $meta_type )
Filters whether a meta key is considered protected.
Description Description
Parameters Parameters
- $protected
-
(bool) Whether the key is considered protected.
- $meta_key
-
(string) Meta key.
- $meta_type
-
(string|null) Type of object metadata is for (e.g., comment, post, term, or user).
Source Source
File: wp-includes/meta.php
Changelog Changelog
| Version | Description |
|---|---|
| 3.2.0 | Introduced. |
User Contributed Notes User Contributed Notes
You must log in before being able to contribute a note or feedback.
Example of 2 meta fields that you want to set as protected:
function my_meta_is_protected_meta( $protected, $meta_key, $meta_type ) { switch ($meta_key) { case 'my_first_meta': $protected = true; break; case 'my_second_meta': $protected = true; break; } return $protected; } add_filter( 'is_protected_meta', 'my_meta_is_protected_meta', 10, 3 );Expand full source codeCollapse full source code