Filter hook 'is_protected_meta'

in WP Core File wp-includes/meta.php at line 1311

View Source

is_protected_meta

Filter Hook
Description
Filters whether a meta key is considered protected.

Hook Information

File Location wp-includes/meta.php View on GitHub
Hook Type Filter
Line Number 1311

Hook Parameters

Type Name Description
bool $protected Whether the key is considered protected.
string $meta_key Metadata key.
string $meta_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user', or any other object type with an associated meta table.

Usage Examples

Basic Usage
<?php
// Hook into is_protected_meta
add_filter('is_protected_meta', 'my_custom_filter', 10, 3);

function my_custom_filter($protected, $meta_key, $meta_type) {
    // Your custom filtering logic here
    return $protected;
}

Source Code Context

wp-includes/meta.php:1311 - How this hook is used in WordPress core
<?php
1306  	 * @param bool   $protected Whether the key is considered protected.
1307  	 * @param string $meta_key  Metadata key.
1308  	 * @param string $meta_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user',
1309  	 *                          or any other object type with an associated meta table.
1310  	 */
1311  	return apply_filters( 'is_protected_meta', $protected, $meta_key, $meta_type );
1312  }
1313  
1314  /**
1315   * Sanitizes meta value.
1316   *

PHP Documentation

<?php
/**
	 * Filters whether a meta key is considered protected.
	 *
	 * @since 3.2.0
	 *
	 * @param bool   $protected Whether the key is considered protected.
	 * @param string $meta_key  Metadata key.
	 * @param string $meta_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user',
	 *                          or any other object type with an associated meta table.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 3
  • File: wp-includes/meta.php
Related Hooks

Related hooks will be displayed here in future updates.