GochiSiyan

register custom taxonomy

Oct 14th, 2021
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. add_action('init', function () {
  2. $tagLabels = [
  3. 'name' => _x('Tagi', 'taxonomy general name'),
  4. 'singular_name' => _x('Tagi', 'taxonomy singular name'),
  5. 'search_items' => __('Search Tags'),
  6. 'popular_items' => __('Popular Tags'),
  7. 'all_items' => __('All Tags'),
  8. 'parent_item' => null,
  9. 'parent_item_colon' => null,
  10. 'edit_item' => __('Edit Tag'),
  11. 'update_item' => __('Update Tag'),
  12. 'add_new_item' => __('Add New Tag'),
  13. 'new_item_name' => __('New Tag Name'),
  14. 'separate_items_with_commas' => __('Separate tags with commas'),
  15. 'add_or_remove_items' => __('Add or remove tags'),
  16. 'choose_from_most_used' => __('Choose from the most used tags'),
  17. 'menu_name' => __('Tags'),
  18. ];
  19. register_taxonomy('small_ad_tag', ['page'], [
  20. 'hierarchical' => false,
  21. 'labels' => $tagLabels,
  22. 'show_ui' => true,
  23. 'update_count_callback' => '_update_post_term_count',
  24. 'query_var' => true,
  25. 'rewrite' => ['slug' => 'small_ad_tag'],
  26. ]);
  27. });
Advertisement
Add Comment
Please, Sign In to add comment