is_protected_meta

Determine whether a meta key is protected.

Description

is_protected_meta( (string) $meta_key, (null) $meta_type = null ); 

Parameters (2)

0. $meta_key (string)
The meta key.
1. $meta_type — Optional. (null) => null
The meta type.

Usage

  1. if ( !function_exists( 'is_protected_meta' ) ) { 
  2. require_once ABSPATH . WPINC . '/meta.php'; 
  3.  
  4. // The meta key. 
  5. $meta_key = ''; 
  6.  
  7. // The meta type. 
  8. $meta_type = null; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = is_protected_meta($meta_key, $meta_type); 
  12.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/meta.php  
  1. function is_protected_meta( $meta_key, $meta_type = null ) { 
  2. $protected = ( '_' == $meta_key[0] ); 
  3.  
  4. /** 
  5. * Filters whether a meta key is protected. 
  6. * @since 3.2.0 
  7. * @param bool $protected Whether the key is protected. Default false. 
  8. * @param string $meta_key Meta key. 
  9. * @param string $meta_type Meta type. 
  10. */ 
  11. return apply_filters( 'is_protected_meta', $protected, $meta_key, $meta_type );