Remove WPML Admin Bar
November 19, 2024 · AI Conversations
### 1. **Remove WPML Admin Bar Items**
Add the following code to your theme's `functions.php` file or a custom plugin:
add_action('admin_bar_menu', function ($wp_admin_bar) {
// Remove WPML menu and submenus
$wp_admin_bar->remove_node('WPML_ALS'); // WPML Language Switcher
$wp_admin_bar->remove_node('wpml_menu'); // WPML Main Menu
}, 999);
This will target and remove the WPML-related items from the admin bar.
—
### 2. **Disable WPML Admin Bar Options**
If you’re not using the admin bar for WPML at all, you can disable it completely. Check WPML settings:
1. Go to **WPML > Languages**.
2. Look for an option related to **Admin Bar Language Switcher**.
3. Disable it, if available.
—
### 3. **Hide Admin Bar on Frontend for Specific Users**
If you don’t need the admin bar at all on the frontend for logged-in users, you can hide it entirely:
add_filter('show_admin_bar', function ($show_admin_bar) {
// Disable admin bar on frontend
if (!is_admin()) {
return false;
}
return $show_admin_bar;
});
—
### 4. **Verify Cache Settings**
After making changes, clear your WordPress cache (if using a caching plugin) and browser cache to see the effects.
Let me know if you'd like more tailored help!