geminilabs

Untitled

Apr 8th, 2021 (edited)
374
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.78 KB | None | 0 0
  1. /**
  2.  * Enables the Custom Fields metabox for reviews
  3.  *
  4.  * To use this snippet, paste it in your active theme's functions.php file.
  5.  *
  6.  * @return void
  7.  */
  8. add_action('admin_init', function () {
  9.     add_post_type_support('provider', 'custom-fields');
  10. });
  11.  
  12. /**
  13.  * Unprotect Site Reviews' hidden meta keys used for assigned rating counts
  14.  *
  15.  * Use this if you have cloned a page that had assigned reviews, this will
  16.  * allow you to remove the obsolete meta keys with the Custom Fields MetaBox.
  17.  *
  18.  * @param bool $protected
  19.  * @param string $metaKey
  20.  * @return bool
  21.  */
  22. add_filter( 'is_protected_meta', function( $protected, $metaKey ) {
  23.     return !in_array( $metaKey, ['_glsr_average', '_glsr_ranking', '_glsr_reviews'] )
  24.         ? $protected
  25.         : false;
  26. }, 10, 2 );
Add Comment
Please, Sign In to add comment