So what is this profile menu dropdown in Ultimate Member? Well, for this tutorial we will be speaking about that that little cog at the top right of the user’s profile. As seen in the image below
Now, let’t imagine that you’d like to remove the cancel button. To do this, we can use the filter um_myprofile_edit_menu_items and manipulate the items. So, let’s get started!
Inside of a custom plugin or your functions.php in your child-theme, add the following snippet.
function suiteplugins_remove_menu_cancel_button( $items = array() ) {
if ( isset( $items['cancel'] ) ) {
unset( $items['cancel'] );
}
return $items;
}
add_filter( 'um_myprofile_edit_menu_items', 'suiteplugins_remove_menu_cancel_button', 12, 1 );
What this snippet will do is check to see if the cancel link is there and if it is then we can remove it.
Adding new menu items
Now, let’s say we wanted to add to the list and not remove. That would be pretty simple too, using the same filter um_myprofile_edit_menu_items. Add the following snippet.
function suiteplugins_add_menu_item( $items = array() ) {
$items['google'] = '<a href="https://google.com" class="real_url">Go to Google</a>';
return $items;
}
add_filter( 'um_myprofile_edit_menu_items', 'suiteplugins_add_menu_item', 12, 1 );
With the above snippet, we are adding a new item with a key of google and and the value is the link to google. Here’s what we get