Skip to content

Instantly share code, notes, and snippets.

@mindctrl
Created January 8, 2025 02:29
Show Gist options
  • Save mindctrl/cc302e1519afe693598433cec787edd4 to your computer and use it in GitHub Desktop.
Save mindctrl/cc302e1519afe693598433cec787edd4 to your computer and use it in GitHub Desktop.
Move and rename WPForms menu in wp-admin
<?php
add_action( 'admin_menu', function() {
global $menu;
// Find the WPForms menu (wpforms-overview)
$wpforms_menu = false;
foreach ( $menu as $key => $menu_item ) {
if ( $menu_item[2] === 'wpforms-overview' ) {
$wpforms_menu = $menu[$key];
unset( $menu[$key] ); // Remove it from the current position
break;
}
}
if ( ! $wpforms_menu ) {
return;
}
// Change menu label
$wpforms_menu[0] = 'Forms';
// Add WPForms menu to a lower position
$menu[101] = $wpforms_menu;
ksort( $menu ); // Sort the menu to maintain proper order
}, 999 );
@mindctrl
Copy link
Author

mindctrl commented Jan 8, 2025

@mindctrl
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment