Skip to content

Instantly share code, notes, and snippets.

@bfillmer
Created August 15, 2014 17:31
Show Gist options
  • Save bfillmer/bfd60e9b14d0c8dd32bb to your computer and use it in GitHub Desktop.
Save bfillmer/bfd60e9b14d0c8dd32bb to your computer and use it in GitHub Desktop.
Quick way to hide protected meta data via a plugin. More robust than the _ prefix.
<?php
add_filter( 'is_protected_meta', 'hide_meta_data', 10, 2 );
/**
* Set our metadata to be protected, will not be seen in administration,
* unless the plugin is deactivated.
* @param array $protected protected values
* @param string $meta_key current meta key
* @return string/bool $protected or true to add
*/
function hide_meta_data( $protected, $meta_key ) {
if( 'shipping-preference' == $meta_key ) return true;
return $protected;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment