add_action( 'admin_menu', 'mx_rename_woocoomerce_admin_menu', 999 ); function mx_rename_woocoomerce_admin_menu() { global $menu; $woo = recursive_array_search_php( 'WooCommerce', $menu ); if( !$woo ) return; $menu[$woo][0] = 'Novi naziv stavke'; } function recursive_array_search_php( $needle, $haystack ) { foreach( $haystack as $key => $value ) { $current_key = $key; if( $needle === $value OR ( is_array( $value ) && recursive_array_search_php( $needle, $value ) !== false ) ) { return $current_key; } } return false; }
Želite li promjeniti ikonu ispred preimenovane stavke, možemo se poigrati s CSS-om i dodati neku od defaultnih ikona ili dodati svoju ikonu/sliku/logo. WP koristi Dashicons pa sam u ovom primjeru zamjenio Woo ikonu s ikonom košarice (dashicons-cart). Želite li i vi koristiti dashicone, postoje još dvije-tri prigodne ikone, poput dashicons-store ili dashicons-products.
add_action('admin_head', 'change_woo_admin_menu_icon'); function change_woo_admin_menu_icon() { echo '<style> #adminmenu #toplevel_page_woocommerce .menu-icon-generic div.wp-menu-image::before { font-family: Dashicons !important; content: "\f312" !important; } </style>'; }