StonehengeCreations

Rename WordPress Category Labels

Aug 28th, 2024 (edited)
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.77 KB | None | 0 0
  1. <?php
  2. /**
  3.  * Renames the WordPress category labels.
  4.  *
  5.  * In some Events Manager translations "Event Categories" has been translated
  6.  * exactly the same as the WordPress "Categories", resulting in two identical
  7.  * named meta boxes in the Edit Event Page.
  8.  *
  9.  * @global object $wp_taxonomies The WordPress Taxonomies object.
  10.  * @return void
  11.  */
  12. function stonehenge_em_rename_wp_categories() {
  13.     global $wp_taxonomies;
  14.    
  15.     $categories = $wp_taxonomies['category'];
  16.     $categories->label                  = 'WP ' . __( 'Categories' );
  17.     $categories->labels->name           = 'WP ' . __( 'Categories' );
  18.     $categories->labels->menu_name      = 'WP ' . __( 'Categories' );
  19.     $categories->labels->singular_name  = 'WP ' . __( 'Category' );
  20. }
  21. add_action( 'init', 'stonehenge_em_rename_wp_categories' );
Advertisement
Add Comment
Please, Sign In to add comment