is_protected_meta

最后更新于:2021-11-27 02:24:01

apply_filters( ‘is_protected_meta’, bool $protected, string $meta_key, string $meta_type )

Filters whether a meta key is considered protected.

参数

$protected

(bool)
Whether the key is considered protected.

$meta_key

(string)
Metadata key.

$meta_type

(string)
Type of object metadata is for. Accepts ‘post’, ‘comment’, ‘term’, ‘user’, or any other object type with an associated meta table.

源文件

文件: gc-includes/meta.php

View on Trac

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 );