geminilabs

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

Aug 11th, 2021 (edited)
138
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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_form" metakey
  11.  * @param bool $protected
  12.  * @param string $metakey
  13.  * @return bool
  14.  */
  15. add_filter('is_protected_meta', function ($protected, $metakey) {
  16.     if ($metakey == '_custom_form') {
  17.         return false;
  18.     }
  19.     return $protected;
  20. }, 10, 2);
RAW Paste Data Copied