wc_check_if_attribute_name_is_reserved

Check if attribute name is reserved.

Description

wc_check_if_attribute_name_is_reserved( (string) $attribute_name ); 

https://codex.wordpress.org/Function_Reference/register_taxonomy#Reserved_Terms.

Parameters (1)

0. $attribute_name (string)
The attribute name.

Usage

  1. if ( !function_exists( 'wc_check_if_attribute_name_is_reserved' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-attribute-functions.php'; 
  3.  
  4. // The attribute name. 
  5. $attribute_name = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wc_check_if_attribute_name_is_reserved($attribute_name); 
  9.  

Defined (1)

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

/includes/wc-attribute-functions.php  
  1. function wc_check_if_attribute_name_is_reserved( $attribute_name ) { 
  2. // Forbidden attribute names 
  3. $reserved_terms = array( 
  4. 'attachment',  
  5. 'attachment_id',  
  6. 'author',  
  7. 'author_name',  
  8. 'calendar',  
  9. 'cat',  
  10. 'category',  
  11. 'category__and',  
  12. 'category__in',  
  13. 'category__not_in',  
  14. 'category_name',  
  15. 'comments_per_page',  
  16. 'comments_popup',  
  17. 'cpage',  
  18. 'day',  
  19. 'debug',  
  20. error,  
  21. 'exact',  
  22. 'feed',  
  23. 'hour',  
  24. 'link_category',  
  25. 'm',  
  26. 'minute',  
  27. 'monthnum',  
  28. 'more',  
  29. 'name',  
  30. 'nav_menu',  
  31. 'nopaging',  
  32. 'offset',  
  33. 'order',  
  34. 'orderby',  
  35. 'p',  
  36. 'page',  
  37. 'page_id',  
  38. 'paged',  
  39. 'pagename',  
  40. 'pb',  
  41. 'perm',  
  42. 'post',  
  43. 'post__in',  
  44. 'post__not_in',  
  45. 'post_format',  
  46. 'post_mime_type',  
  47. 'post_status',  
  48. 'post_tag',  
  49. 'post_type',  
  50. 'posts',  
  51. 'posts_per_archive_page',  
  52. 'posts_per_page',  
  53. 'preview',  
  54. 'robots',  
  55. 's',  
  56. 'search',  
  57. 'second',  
  58. 'sentence',  
  59. 'showposts',  
  60. 'static',  
  61. 'subpost',  
  62. 'subpost_id',  
  63. 'tag',  
  64. 'tag__and',  
  65. 'tag__in',  
  66. 'tag__not_in',  
  67. 'tag_id',  
  68. 'tag_slug__and',  
  69. 'tag_slug__in',  
  70. 'taxonomy',  
  71. 'tb',  
  72. 'term',  
  73. 'type',  
  74. 'w',  
  75. 'withcomments',  
  76. 'withoutcomments',  
  77. 'year',  
  78. ); 
  79.  
  80. return in_array( $attribute_name, $reserved_terms );