Change the links in the menu

Need to change the current links for the, The Register, and the Login button in the top right corner of the site. Not able to find where these links got added after migrate. Looking to change the links, please advise.

  • Nithin

    Hello Dr. Berge,

    Hope you are doing good today. :slight_smile:

    You can change the mentioned links with jQuery, the relevant code for that would be:

    add_action( 'wp_footer', 'wpmu_change_links' );
    function wpmu_change_links() {
        <script type="text/javascript">
          jQuery(document).ready(function() {
    	jQuery("#masthead > div.header-wrap > div > div > > div > a.register.screen-reader-shortcut").attr("href", "")
    	jQuery("#masthead > div.header-wrap > div > div > > div > a.login").attr("href", "")

    You can implement the above code either in your child themes functions.php file, or as a mu-plugins. Please check the following manual on how to add the code via mu-plugins:

    Please let me know if you have any further query related to this. Have a great day ahead. :slight_smile:

    Best Regards,

  • Dr48

    Thank you Nithin!
    I went ahead and followed your steps (new territory!) but I'm having issues -- it appears the register and login buttons/icons are still linking to the BP links, and not the Membership2 pages -- I'm trying again and have created a staging environment (new too) so I'm double checking (though am waiting for the servers to update) -- I'll write back to confirm the issue again as soon as the servers have updated.

    Thank you again!

  • Dr48

    Hello Rupok,

    Thank you -- the issue still exists.

    My sites were propagated a few days ago and once it was final these 2 x new icons appeared in the top right hand header -- "login" + "register" -- they're coming from BP and go to the respective BP pages. The issue is as the site uses Membership2, all users need to "login" and "register" via the respective pages.

    NOTE: Membership2 register page is currently back-linking to BP registration (this was reported a few weeks ago, so maybe it needs to be reported again) -- this is why members/users need to sign up via the home page -- which is our 'register' page too [the code for register and home is the same for Membership2, however once you head to register, you're presented with the BP register layout -- this ISN'T a concern right now as when it was a few weeks ago, before the home page changes, it affected ALL my members and sign up was broken from this -- so i don't want to play with this until the developers fix this.

    As written above and what Nithin was helping with -- was changing the login + register header icons to direct to the Membership2 pages i.e. for login is literally /login and for register it is our home page.

    When applying the above code i created a staging site (first time at my end so I was being cautious) then went to File Manager - wp-content - mu-plugins - add file - then proceeded to add the above text. NOTE: this is the first time I've tried to actually access these files (normally i hesitate as don't want to mix anything up) -- so, I'm not entirely sure if i did everything correctly -- is what I'm saying -- but i "think" i did and had guidance from my hosting support -- but now with the staging site live, no changes have taken affect and the links/icons keep directing to the BP respective pages.

    Please help :slight_smile: [also if not already flagged, the issue above about the Membership2 register page issue, would be nice to have it fixed, although we've found a way around it by changing pages anyway -- but it initially caused major issues a few weeks back]

    Thank you kindly and i hope I've provided enough information, too :slight_smile:

  • Dr48

    Update -- I've managed to narrow down the cause -- it looks like these are outputted via the theme (?) though I can't find it in the settings? If you head to another page other than the homepage, you will now see a login column -- following the same format (hinting at maybe it is the theme). There is no widget in the header to delete.

    What I'm thinking is to delete/hide the login + register in the header -- and to replace this with the right column (widgets) -- however i can't seem to bring these to the homepage -- if doable, it would be helpful.

    Next then is fixing the links -- they're still outputting to the default BP pages -- these need to be Membership2 pages (i.e. as they are) -- so for the links then in the widgets should be able to be replaced (?) -- hopefully a lot easier than inputting the above jQuery [note: changes have been made to live site now, not staging -- staging therefore is now old version].

    The primary concern is the buttons/icons and for them to match the Membership2 links -- i would ideally like the right column as this would then allow the Membership2 page (on the home page) to go back to Register (although this page is still outputting default BP so it may be another linked page since there appears to be something wrong with the 'register' page picking up the right actions.

    Final -- by bringing the right widget column to the homepage this can replace the header login/register BP links and by using these widgets, simpler to adjust the right links i.e. to direct to Membership2. This then calls for the homepage to no longer be the Membership2 register page (but is since 'register' page is broken i.e. resorting to bp over Membership2) and to simply be moved to a 'new' page that works -- i would simply say direct to the register page, but this is not cooperating, so it could literally be cloning the homepage, example, and renaming. This should then fix the problem without fiddling with the files and help clean up the front end :slight_smile:

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.