Tagged: new
Hi there, I have been trying to remove the “profile” subnav menu item.
Apparently the slug is “public” but that or none of the other slugs I have tried in this code snippet works?
What slug should I insert to make it work?
function bp_remove_nav_item() { global $bp; bp_core_remove_subnav_item( $bp->profile->slug, ' ? ' ); } add_action( 'wp', 'bp_remove_nav_item' );
Regards
CarstenHi Carsten,
This works fine for me.add_action( 'wp', function () { bp_core_remove_subnav_item( 'profile', 'public' ); } );
Please do note that it will break access to user’s profile view as the ‘public’ is the default sub nav for profile.
Also, here is a slightly better version to avoid fatal errors when BP is disabled.add_action( 'wp', function () { if ( function_exists( 'bp_core_remove_subnav_item' ) ) { bp_core_remove_subnav_item( 'profile', 'public' ); } } );
Regards
BrajeshHi Carsten,
That’s exactly what I mentioned in my previous reply.You can not remove a default sub nav without forcing another default.
‘public’ is the default profile sub nav and you are removing it causing 404. If you are getting redirected to somewhere else, you may have a 404 redirection enabled.Regards
BrajeshHi Brajesh, sorry for not perceiving this in your reply. So the conclusion is, that it is not possible to remove this tab.
It is a bit redundant on other profiles, and does nothing good for the design with two profile tabs on top of each other. I guess I can hide it with css then.
Regards
CarstenHi Carsten,
No issues.It is possible to remove tabs if you are able to provide a substitute default tab.
Also, It seems that in your use case, all you need is to hide the sub tab markup and no the actual content. I will suggest using css for that purpose.
Regards
Brajesh
You must be logged in to reply to this topic.