Advertisement
geminilabs

[site-reviews] Enable the Custom Fields metabox and unprotect form metakey

Aug 11th, 2021 (edited)
416
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.47 KB | None | 0 0
  1. /**
  2.  * Enables the Custom Fields metabox for reviews
  3.  * @return void
  4.  */
  5. add_action('admin_init', function () {
  6.     add_post_type_support('site-review', 'custom-fields');
  7. });
  8.  
  9. /**
  10.  * Unprotect the Site Reviews "_custom_*" metakeys
  11.  * @param bool $protected
  12.  * @param string $metakey
  13.  * @return bool
  14.  */
  15. add_filter('is_protected_meta', function ($protected, $metakey) {
  16.     if (substr($metakey, 0, 8) === "_custom_") {
  17.         return false;
  18.     }
  19.     return $protected;
  20. }, 10, 2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement