Change the items in the drop-down menu

7.49K viewsThemes
0

Hi everyone,

I was wondering how can I change the items in the dropdown menu? I would like to remove some sections that I’m not using.
I searched a lot and I didn’t find anything which might help me to fix my issue.

Could someone tell me which file I need to edit?

Thank you,

Audran 🙂

PS:  I’m actually using Askbug

AnsPress 4.0 or 3.x?

3.0.7 🙂

up please

Please tell me which items you want to remove or modify. I will show the exact code for that purpose

0

Hello,

Sorry for late replay. here is an example:

function my_ap_user_menu( $menus ) {
	// var_dump( $menus ); // This will show all menu items.

	if ( isset( $menus['notifications'] )) {
		unset( $menus['notifications'] );
	}
}
add_filter( 'ap_user_menu', 'my_ap_user_menu' );

This above code will remove notifications item from user menu.

edited comment on answer

Hi man ! Thank you so muck for answering, but when we past it into the ‘function.php’ file, it delets all the items. Not only ‘notifications’. Is there anything to do about that ?

And it delets all the items even with :

function my_ap_user_menu( $menus ) {
var_dump( $menus );
}
add_filter( ‘ap_user_menu’, ‘my_ap_user_menu’ );

So i don’t understand … Have you got any idea what should i do ?

Please read the basics of WordPress filter in wp.org. You must return in filter callback.

So I apply ‘my_ap_user_menu’ to ‘ap_user_menu’ by adding :
add_filter( ‘ap_user_menu’, ‘my_ap_user_menu’ );
In ‘hooks.php’ ?
And then i add the function
‘my_ap_user_menu’ in ‘functions.php’ ?

You are viewing 1 out of 3 answers, click here to view all answers.